列表中的项目数过滤 AngularJS [英] Number of items in a list filtered AngularJS
本文介绍了列表中的项目数过滤 AngularJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获得 AngularJS 中的过滤器预测返回的项目的长度/数量?
How do you get the length/number of items returned by a filter predictate in AngularJS?
推荐答案
感谢 Pawel Kozlowski,我设法在 AngularJS Google Group 上找到了很好的答案.
I managed to find a great answer on the AngularJS Google Group, thanks to Pawel Kozlowski.
ng-repeat="item in filtered = (items | filter:filterExpr)"
将动态创建 filtered
列表,您可以使用 filtered.length
在当前范围内的任何其他地方来显示计数.
Would create the filtered
list on the fly, you can use filtered.length
anywhere else in the current scope to show the count.
这篇关于列表中的项目数过滤 AngularJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文