Javascript 如何在同一ui选择字段上应用筛选器:$select.search和limito:$select.infiniteCurrentLimit?
我有一个ui选择字段,它使用无限滚动功能,因为它可能有大量的选项,但由于有很多,向下滚动以找到所需的选项是很累的Javascript 如何在同一ui选择字段上应用筛选器:$select.search和limito:$select.infiniteCurrentLimit?,javascript,angularjs,infinite-scroll,ui-select,Javascript,Angularjs,Infinite Scroll,Ui Select,我有一个ui选择字段,它使用无限滚动功能,因为它可能有大量的选项,但由于有很多,向下滚动以找到所需的选项是很累的 <ui-select-choices infinite-scroll="$select.infiniteStepIncrement()" infinite-scroll-distance="2" infinite-step="2" current-limit="10" all-options="app.bigList" repe
<ui-select-choices
infinite-scroll="$select.infiniteStepIncrement()"
infinite-scroll-distance="2"
infinite-step="2"
current-limit="10"
all-options="app.bigList"
repeat="option.id as option in app.bigList | limitTo: $select.infiniteCurrentLimit">
<span ng-bind-html="option.value"></span>
</ui-select-choices>
所以我决定实现filter:$select:search。它过滤选项,但取消可滚动功能
<ui-select-choices
infinite-scroll="$select.infiniteStepIncrement()"
infinite-scroll-distance="2"
infinite-step="2"
current-limit="10"
all-options="app.bigList"
repeat="option.id as option in app.bigList | filter: $select.search | limitTo: $select.infiniteCurrentLimit">
<span ng-bind-html="option.value"></span>
</ui-select-choices>
我能为他们一起工作做些什么吗?在谷歌搜索、反复尝试和出错后找到了解决方案。 我只是将
app.bigList
和filter
分组,这样它就可以作为一个已经过滤过的列表返回,供limito
处理。有点像彭达斯
repeat="option.id as option in (app.bigList | filter: { value: $select.search }) | limitTo: $select.infiniteCurrentLimit">