Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get length of filtered array #251

Open
darrenst opened this issue Jun 2, 2017 · 2 comments
Open

Get length of filtered array #251

darrenst opened this issue Jun 2, 2017 · 2 comments

Comments

@darrenst
Copy link

darrenst commented Jun 2, 2017

Hello, How can I get a reference to the length of the filtered array, into a scope variable for use elsewhere?

@codekraft-studio
Copy link

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 }}

@kevinah95
Copy link

You can use the alias expression too: https://stackoverflow.com/a/19517533

<div ng-repeat="person in data | filter:query as filtered">
</div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants