title: Angular.js: How to count number of elements in nested ng-repeat
body: <p>So, the situation I have is I'm looping through a list of JSON objects, which contain a list as an attribute. I have an inner loop repeating on that list attribute. Something along the lines of this:</p>
  
  <pre><code>Number of results: {{count}}
  
  &lt;div ng-repeat="jsonObject in outerList | someFilter" ng-show="innerList.length"&gt;
      &lt;h1&gt;{{jsonObject.Name}}&lt;/h1&gt;&lt;br&gt;
      &lt;div ng-repeat="items in jsonObject.listAttr | someOtherFilter as innerList"&gt;
          {{items.data}}&lt;br&gt;
      &lt;/div&gt;
      &lt;br&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The issue I'm facing is finding a way to grab an aggregated count of all the elements across every iteration of the inner repeat. So, if the first jsonObject has 2 things that match the inner filter, and the second jsonObject has 3 things that match the inner filter, we show a count of 5 outside the whole loop (in the count variable above, or something similar).</p>
  
  <p>I've looked into a number of ways to try and get that count, but without any success. One of the wrenches that is thrown into some solutions I've found is that the filters are something that the user can change on the fly (via a search box, for one), so I can't just apply all the filters in the controller at page load and display that. I may start with 5 objects, until the user types something into the search box that drops the number down to 2.</p>