angular select2与较大的数据集相比较慢

Jas*_*son 8 angularjs ui-select2 angularjs-select2

我正在尝试使用数据集为5,000的select2.

交互很慢,尤其是搜索.我需要在不久的将来处理> 500,000的数据集.

有关如何提高效率的任何建议?

我没有使用bootstrap typeahead的性能问题,虽然已经授权,但功能和显示元素较少.我也不知道搜索功能如何与typeahead一起使用.

这是plunker示例,与select2的演示相同,但​​有5,000行数据 http://plnkr.co/edit/RyCTTloW6xp81WvoCzkf?p=preview

<ui-select ng-model="person.selected" theme="select2" ng-disabled="disabled" style="min-width: 300px;">
    <ui-select-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.name}}</ui-select-match>
    <ui-select-choices repeat="person in 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>
</ui-select>
Run Code Online (Sandbox Code Playgroud)

小智 1

我有同样的问题。Ui-select 的性能确实很差。我建议使用选择。它的表现要好得多,但我认为 500k 可能太多了。Angular Material Virtual Lists 可以是答案。它们当时仅呈现几个选项并且仅更新绑定。