首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何限制与我的角度ui-选择链接的10,000个对象的数组?

如何限制与我的角度ui-选择链接的10,000个对象的数组?
EN

Stack Overflow用户
提问于 2015-10-12 20:59:46
回答 3查看 4.6K关注 0票数 4

我有一个包含10,000个对象的数组,每次单击select,它都会使浏览器崩溃。是否有限制ui-select一次只能在屏幕上显示10?此外,我使用的库是ui-选择

代码语言:javascript
复制
 <ui-select ng-model="ed.main.user.UserID.selected" theme="bootstrap">
     <ui-select-match placeholder="{{main.editTicket.UserDisplayName}}">
         {{$select.selected.DisplayName}}
     </ui-select-match>
     <ui-select-choices repeat="t in main.users |filter:$select.search"value="{{$selected.UserID}}">
         <div ng-bind-html="t.DisplayName | highlight: $select.search"></div>
         <small ng-bind-html="t.UserID | highlight: $select.search"></small>
     </ui-select-choices>
 </ui-select>
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2015-10-12 21:02:50

看看limitTo例如..。

代码语言:javascript
复制
<select ng-model="model" ng-options="o as o for o in items | limitTo: 10"></select>

JSFiddle链路 -演示

根据您的更新,修改您的repeat如下

代码语言:javascript
复制
<ui-select-choices repeat="t in main.users | filter:$select.search | limitTo: 10"value="{{$selected.UserID}}">
    <div ng-bind-html="t.DisplayName | highlight: $select.search"></div>
    <small ng-bind-html="t.UserID | highlight: $select.search"></small>
</ui-select-choices>
票数 10
EN

Stack Overflow用户

发布于 2016-06-28 13:31:10

她是我的解决方案,让你补充卷轴上的新项目。也适用于可能太大的筛选列表。

代码语言:javascript
复制
       <ui-select-choices 
         position="up" 
         all-choices="ctrl.allTenThousandItems"  
         refresh-delay="0"
         repeat="person in $select.pageOptions.people | propsFilter: {name: $select.search, age: $select.search} ">
      <div ng-bind-html="person.name | highlight: $select.search"></div>
      <small>
         email: {{person.email}}
         age: <span ng-bind-html="''+person.age | highlight: $select.search"></span>
       </small>
   </ui-select-choices>

详细答复

普朗克

票数 1
EN

Stack Overflow用户

发布于 2018-10-09 09:55:39

在html中只使用limitTo:itemsPerPage。使用limitTo函数动态更改$timeout值。从要加载更多选项的位置调用addMoreChoices()

代码语言:javascript
复制
 addMoreChoices();
function addMoreChoices(){
            if($scope.itemsPerPage<$scope.List.length){
                $scope.itemsPerPage += 100;
                $timeout(addMoreChoices, 100);
            }
        } 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33090118

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档