我有一个Java后端API,它为我提供分页结果。对于典型的数据列表视图,我使用无限滚动。但是,如何在选择框中使用此开箱即用。
我挖掘了这个PR,https://github.com/angular-ui/ui-select/pull/620,但不知道如何使用它。此外,同一位作者在他的上一篇文章中提到它仍然是错误的。
如果没有现成的解决方案,那么下一个最佳解决方案似乎就是这样 - 使用选择框内的按钮并点击"加载更多..."这是一种hacky: https://jsfiddle.net/betonetotbo/0yfhe7pf/
<ui-select ng-model="data.selected" theme="bootstrap">
<ui-select-match placeholder="Type 'a' to display results...">
{{$select.selected.full_name}}
</ui-select-match>
<ui-select-choices
refresh="fetch($select)"
refresh-delay="300"
repeat="item in items | filter: $select.search"
>
{{$index}} - {{item.full_name}}
<div ng-if="$index == $select.items.length-1">
<button
ng-if="!useNgMouseover"
class="btn btn-xs btn-success"
style="width: 100%; margin-top: 5px;"
ng-click="fetch($select, $event);"
ng-disabled="loading">Load more...</button>
</div>
</ui-select-choices>
</ui-select>
我很确定那里的人已经实现了它。有线索吗?