title: How to aggregate object properties after filtering in ng-repeat angular
body: <p>I'm using Angular 1.2.16 and filtering a list of objects like this: </p>
  
  <pre><code>&lt;li ng-repeat="item in filteredItems = (items | filter:query)"&gt;
    {{item.title}}
  &lt;/li&gt;
  </code></pre>
  
  <p>lets say I have the "items" array below </p>
  
  <pre><code>var items = [ { title: "foo", priority: 1 },
                { title: "bar", priority: 2 },
                { title: "bla", priority: 1 } ];
  </code></pre>
  
  <p>and after being filtered with "b", angular sets "filteredItems" to </p>
  
  <pre><code>filteredItems == [ { title: "bar", priority: 2 },
                     { title: "bla", priority: 1 } ];
  </code></pre>
  
  <p>What I'm looking to do is count the occurrences of each priority type, post-filter, and print them out. E.g. the output given the above scenario would print <code>priority-1 = 2, priority-2 = 1</code> and then becomes <code>priority-1 = 1, priority-2 = 1</code> after the filter "b" is applied. </p>
  
  <p>How should I do this in angular? </p>
  
  <p>I tried creating a new controller and then using <code>$scope.$parent.filteredItems</code> but the filteredItems piece doesn't update dynamically.</p>
  
  <p>Here's a plunkr <a href="http://plnkr.co/edit/uA5TgBVFVEd89dHSP0Yo" rel="nofollow">http://plnkr.co/edit/uA5TgBVFVEd89dHSP0Yo</a> </p>