title: Using angularjs filter and _.groupBy
body: <p>Here's a simple example I created to replicate my issue. In my controller, I have an array of people:</p>
  
  <pre><code>$scope.people = [
      { name: 'fred', age: 20 },
      { name: 'bob', age: 22 },
      { name: 'jane', age: 24 },
      { name: 'mary', age: 22 },
      { name: 'ben', age: 24 },
      { name: 'sarah', age: 21 },
  ];
  </code></pre>
  
  <p>I have a filter defined:</p>
  
  <pre><code>.filter('grouped', function () {
      return function (input) {
          return _.groupBy(input, 'age');
      }
  })
  </code></pre>
  
  <p>You may notice that I'm using Lo-Dash to do the group by.</p>
  
  <p>In my view I have a list defined:</p>
  
  <pre><code>&lt;div class="list" ng-repeat="personGroup in people | grouped"&gt;
      {{ $index }}
      &lt;div class="list" ng-repeat="person in personGroup"&gt;
          {{ person.name }}
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>I get the result I'm after but I get a heap of errors in my developer console.</strong></p>
  
  <blockquote>
    <p><a href="https://docs.angularjs.org/error/" rel="nofollow">https://docs.angularjs.org/error/</a>$rootScope/infdig?p0=10</p>
  </blockquote>
  
  <p>I understand why I'm getting the error. This is explained in detail in the above link. I just don't know the proper way of achieving the result I'm after.</p>