Search code examples
angularjsangularjs-ng-repeatangular-filters

Display size of ng-repeat with filter


I am currently working on an analytics backend web app and am using ng-repeat to show a table for some data I am working with. Is there a way to show the number of total results found when using a filter with ng-repeat? I would like to display this beneath my table.


Solution

  • You can retrieve the filtered data in a var like this :

    <div ng-repeat="product in filteredProducts = (products | filter:search)"> 
    

    So inside your ng-repeat you can do something like filteredProducts.length