我有这段代码:
<tr ng-repeat="person in ctrl.persons
| filter : { name: filterName, email: filterEmail} as filtered">
Number of persons filtered by mail and name: {{filtered.length}}
现在我添加另一个过滤器:
<tr ng-repeat="person in ctrl.persons
| filter : { name: filterName, email: filterEmail}
| limitTo : ctrl.size as filtered">
Number of persons filtered by mail and name: {{filtered.length}}
我的问题是,通过邮件和姓名过滤的人数现在是错误的,因为它仅限于size
。解决这个问题的最佳解决方法是什么?
谢谢!
答案 0 :(得分:0)
我用括号解决了这个问题:
<tr ng-repeat="person in filteredPersons = (ctrl.persons
| filter : { name: filterName, email: filterEmail})
| limitTo : ctrl.size as filtered">
Number of persons filtered by mail and name: {{filteredPersons.length}}