Get length of filtered array
darrenst opened this issue · comments
Hello, How can I get a reference to the length of the filtered array, into a scope variable for use elsewhere?
I guess you could try like this:
<th ng-repeat="user in (filteredUsers = users | filterBy: ['id']: 1)">
{{ user.id }} : {{ user.first_name }} {{ user.last_name }}
</th>
{{ filteredUsers.length }}
You can use the alias expression too: https://stackoverflow.com/a/19517533
<div ng-repeat="person in data | filter:query as filtered">
</div>