M
M
michaildas2016-10-28 16:56:26
JavaScript
michaildas, 2016-10-28 16:56:26

How to get the number of elements passed filtering in AngularJS?

There is a chain of filters. I need to know the number of elements passed through the very first searchText filter.

<tr ng-repeat="item in items |filter: searchText|startFrom: currentPage * itemsPerPage
            | limitTo: itemsPerPage| orderBy:property:reverse">

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Belov, 2016-10-28
@AlexanderBelov

1) Assign a variable (for example, myVar) for the result
2) myVar.length

F
funber, 2016-10-29
@funber

I would advise not to use template filters and do it all in the component controller via $filter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question