Reputation: 4328
I am using the 'filter' filter of AngularJS like this:
<li ng-repeat='item in items | filter: searchTerm'></li>
Now, how do I find out the length of array returned by the filter?
Thanks in advance
Upvotes: 0
Views: 104
Reputation: 6771
Or, a more simple solution:
<li ng-repeat='item in filtered = (items | filter: searchText)'></li>
Then:
{{filtered.length}}
Upvotes: 1
Reputation: 15290
check this one
<li ng-repeat='item in ($parent.filterR=(items | filter: searchTerm))' >
</li>
{{filterR.length}}
Upvotes: 1
Reputation: 3954
HTML
<li ng-repeat='item in items | filter: searchTerm' check>
</li>
Directive
app.directive('check',function(){
return {
restrict: 'A',
link: function (scope, el, attrs) {
if(scope.$last){
alert(scope.$index+1);//count value
}
}
});
I hope this will help you
Upvotes: 0