AngularJS Accessing a filtered list from outside an ng-repeat


Occasionally you will want to access the result of your filters from outside the ng-repeat, perhaps to indicate the number of items that have been filtered out. You can do this using as [variablename] syntax on the ng-repeat.

  <li ng-repeat="item in vm.listItems | filter:vm.myFilter as filtered">
<span>Showing {{filtered.length}} of {{vm.listItems.length}}</span>