我正在尝试在一个简单的网格上实现无限类型滚动。 html是这样的:
<div class="text-center" style="background-color:#eee;">
<H2 style="margin-top:0px;">Customer List</H2>
<hr />
Search: <input ng-model="customerVm.search" /> <br /> <br />
<table class="table table-hover" ui-scroll-viewport style="height:500px;">
<tbody>
<tr ui-scroll="customer in customerVm.datasource" ng-model="customerVm.gridResult" "buffer-size="10">
<td>
</tbody>
</table>
</div>
我想根据搜索框模型过滤网格中的内容,看起来很简单。我通常只会将以下内容与 ng-repeat 一起使用
<tr ng-repeat="customer in customerVm.datasource | filter:customerVm.search" ng-model="customerVm.gridResult" "buffer-size="10">
<td>{{customer.customername}}</td>
</tr>
但是使用“ui-scroll”而不是 ng-repeat 时出现错误
Expected uiScroll in form of '_item_ in _datasource_' but got 'customer in customerVm.datasource | filter:customerVm.search'
我是否遗漏了有关如何使用 Angular-ui 滚动过滤数据的内容?我在 scroll lib 中看到导致问题的行,如果有任何其他内容,则会引发错误
item in datasource
这让我觉得在 Angular-ui scroll 中过滤是不可能的。伙计们有什么想法吗?
最佳答案
不幸的是,正如错误提示的那样,目前还无法通过这种方式进行过滤。请参阅 Readme file 中的“参数” .您可以在数据源“get”函数中实现自己的过滤器。又见官方examples .
关于javascript - 过滤 Angular-ui 滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27256252/