我已为ngtable
实施了过滤器。尝试显示过滤后的项目数量,如下所示:
如何在此处显示已过滤行的nr
?在表定义之外?
{{filtered.length}}
与过滤器匹配的结果
<table ng-table="tableParams" class="table">
<tr ng-repeat="account in filtered =($data | filter:search.accountName | filter:search.id)">
<td>{{filtered.length}}</td>
<td data-title="'id'">
{{account.account.accountId.id}}
</td>
<td data-title="'name'">
{{account.account.accountName}}
</td>
</tr>
</table>
答案 0 :(得分:2)
只需在你的ng-repeat过滤之前添加$ parent,你就可以了。 Ng-repeat具有独立的范围。
<tr ng-repeat="account in $parent.filtered =($data | filter:search.accountName | filter:search.id)">
答案 1 :(得分:0)
如果在子范围内使用数组之前创建数组,那么他们将引用并使用父范围中的数组
JS
$scope.model = {filtered:[]}
HTML
How to display nr of filtered? {{model.filtered.length}} result(s) matching the filter
<tr ng-repeat="account in model.filtered =($data | filter:search.accountName | filter:search.id)">
答案 2 :(得分:-1)
使用内置功能:
total() {{ tableParams.total() }}