项的列表中的过滤AngularJS数 [英] Number of items in a list filtered AngularJS

查看:117
本文介绍了项的列表中的过滤AngularJS数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何通过一个过滤器predictate在AngularJS归还物品的长度/多少?

How do you get the length/number of items returned by a filter predictate in AngularJS?

推荐答案

我设法找到在AngularJS谷歌集团有很大的答案,感谢帕维尔·科兹洛夫斯基。

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.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆