Itsik Mauyhas Itsik Mauyhas - 6 months ago 51
AngularJS Question

Angular get row count with several filters

I am having a problem with

row
count in after
ng-repeat
and more then one
filter
, I want to count the current number of rows after filtering the table with more then one filter, example:

<tr ng-repeat="person in data | filter:query | filter : name | filter {m_resource: resourceFilter} | filter : {m_id : idFilter}">
</tr>


The
m_resource, m_id
are filds in
data
, I can't use as filter due
badidnet
error, is there amother way to do it?

Answer

You should be able to do something like this:

ng-repeat="person in filtered = ( data | filter:query | filter : name | filter {m_resource: resourceFilter} | filter : {m_id : idFilter} )"

And then use {{ filtered.length }} for the number of rows.