In my current project I have a two nested ng-repeats, where the outer ng-repeat provides an argument the inner ng-repeat needs to filter out the data + some additional custom filtering on the controller. I'd like to know what the total filtered count is of the inner nested elements for the whole overview of the dataset.
Consider the following stripped down structure:
<div ng-repeat="division in divisions">
<!-- some division related stuff like logo, name, ... comes here (header of the division) -->
<ol>
<li ng-repeat="member in members | orderBy:['position'] | filter:{divisionabbr:division.abbr} | filter:myCustomFilter"><!-- some member stuff here, like name --></li>
</ol>
<!-- some division footer stuff -->
</div>
My question is: how can I get the total number of filtered members and thus displaying on the whole page.
As an extra I'd like to have this count on my controller/scope so that I can communicate it to other controllers.
I've tried the following solutions:
- https://stackoverflow.com/a/20900403/341358 (see my comment, this count isn't updating correctly on data reloads/partial dataset refreshes)
- https://stackoverflow.com/a/19517533/341358 (doesn't work with nested ng-repeat because of scope issues)
Any suggestions?