title: Why is my custom filter causing infinite digestion?
body: <p>I created a custom filter to break an array of key-value pairs into an object that groups values by the first letter of a particular property. For example</p>
  
  <blockquote>
    <p>Input: <code>[{foo: 'bar'}, {faz: 'baz'}, {boo: 'foo'}]</code> </p>
    
    <p>Output: <code>{f: [{foo: bar}, {faz: baz}], b: [{boo, foo}]}</code></p>
  </blockquote>
  
  <p>However this filter seems to be causing an infinite digestion error in Angular.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var app = angular.module('app', []);
  
  app.controller('ctrl', ['$scope', function($scope){
    $scope.arr = [{name: 'foo', def: 'bar'}, {name: 'faz', def: 'baz'}, {name: 'boo', def: 'foo'}]
  }]);
  
  app.filter('firstLetterChunks', function() {
      return function(input){
          var chunks={};
          for(var i = 0; i &lt; input.length; i++){
              var firstLetter = input[i].name[0].toUpperCase();
              if(!(chunks.hasOwnProperty(firstLetter))) {
                  chunks[firstLetter]=[];
              }
              chunks[firstLetter].push(input[i]);
          }
  
          return chunks;
      };
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"&gt;&lt;/script&gt;
  
  &lt;div ng-app="app"&gt;
    &lt;div ng-controller="ctrl"&gt;
      This caused a infdig error. Check your console.
      &lt;div ng-repeat="(firstletter, values) in arr | firstLetterChunks"&gt;
        {{firstletter}}
        &lt;hr&gt;
        &lt;div ng-repeat="value in values"&gt;
          {{value}}
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>and I cant figure out why. From what I've found, this is usually caused by modifying your model in the filter, thus re-triggering the ng-repeat, however I don't think I'm doing this.</p>