javascript - 如何限制与我的 Angular ui-select 链接的 10,000 个对象的数组?

标签 javascript html angularjs angularjs-directive angular-ui

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

 <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>

最佳答案

查看 limitTo例如...

<select ng-model="model" ng-options="o as o for o in items | limitTo: 10"></select>

JSFiddle Link - 演示


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

<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>

关于javascript - 如何限制与我的 Angular ui-select 链接的 10,000 个对象的数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33090118/

相关文章:

javascript - 在 Chrome 中动态添加 <hr> 显示问题

html - 嵌套图像链接没有宽度,定义了所有父元素大小

html - 我怎样才能逆时针显示一个元素?

angularjs - http-server 未在 systemd 中启动

javascript - $http.post 来自模态形式的数据( Angular )

javascript - 如何在客户端和服务器中正确使用 OpenTelemetry 导出器和 OpenTelemetry 收集器?

javascript - 如果以其他语言保存,如何从服务器获取数据?

javascript - jQuery 验证插件多个复选框

javascript - 如何定位除 IE 和 Edge 之外的所有浏览器

c# - 在节点和边列表中查找循环引用