I use angular-ui-select with a list of ~1500 items in bootstrap modal window.
There is a delay of 2 seconds for every action the user does. I tried to improve performance by by using 'minimum-input-length', but the filter does not work.
Plunkr example: https://plnkr.co/edit/H0kbeR4kHfZFjsBnpjBC?p=preview
MY Html:
<ui-select multiple sortable="true" ng-model="vm.selected" theme="select2" style="width: 100%;">
<ui-select-match placeholder="Select...">{{ $item.name }}</ui-select-match>
<ui-select-choices repeat="item in vm.items | filter: $select.search" minimum-input-length="2">
<div ng-bind-html="item.name | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
How to apply Minimum characters filter?
Thanks.
I solved that using a LimitTo, checking the search length:
limitTo: ($select.search.length <= 2) ? 0 : undefined"
the complete code:
<ui-select-choices
repeat="item in ctrl.items | filter: $select.search | limitTo: ($select.search.length <= 2) ? 0 : undefined">
As i believe the minimum length will only work with use of the refresh function. The performance is still a issue as there are many issue.
Documentation of uiselect
Minimum characters required before refresh function is triggered
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With