带过滤器的 ng-repeat 的显示大小

Display size of ng-repeat with filter

我目前正在开发一个分析后端 Web 应用程序,并且正在使用 ng-repeat 为我正在处理的一些数据显示 table。有没有办法显示在使用带有 ng-repeat 的过滤器时找到的总结果数?我想在我的 table.

下面显示它

您可以使用 ngRepeat

的 $last 变量

在你的 ng-repeat 中这样的东西就可以了:

<div ng-if="$last"> Total results found: {{ $index + 1 }} </div>

请注意您应该向 $index 添加 1,因为它从 0

开始

您可以像这样在 var 中检索过滤后的数据:

<div ng-repeat="product in filteredProducts = (products | filter:search)"> 

所以在你的 ng-repeat 里面你可以做类似 filteredProducts.length