Jimi
Jimi

Reputation: 1907

Angularjs ng-repeat counting filtered items with AND condition

I'm using checkboxes to filter a resultset from a json file. It's working fine, but I would like to have the count (from the filtered resultset only) appearing next to each filter. I've tried a few ways to do this but I can only end up getting the length of the result itself or the json output.

I have a plunk

( {{ data.list|filter:itemFilter[option.name].count }} )

Another plunk

Any help is appreciated.

Jimi

Upvotes: 0

Views: 502

Answers (1)

Josep
Josep

Reputation: 13071

You can do it like this:

{{ ((data.list | filter:itemFilter)|filter:option.name).length }}

Working Example

Upvotes: 1

Related Questions