title: angularjs infinite $digest Loop when no scope changes
body: <p>I'm getting the below error in my angular code. I'm struggling to understand why the function getDrawWithResults would cause a digest cycle as there don't seem to be any side effects? It just returns items from a list that have a property set to true.</p>
  
  <p>The error only occurs when the first use of getDrawWithResults is on the page, if I remove, the error stops.</p>
  
  <pre><code>Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
  Watchers fired in the last 5 iterations: [["getDrawsWithResults(selectedLottery.draws); newVal: []; oldVal: []"],["getDrawsWithResults(selectedLottery.draws); newVal: []; oldVal: []"],["getDrawsWithResults(selectedLottery.draws); newVal: []; oldVal: []"],["getDrawsWithResults(selectedLottery.draws); newVal: []; oldVal: []"],["getDrawsWithResults(selectedLottery.draws); newVal: []; oldVal: []"]]
  </code></pre>
  
  <p>This is my code:</p>
  
  <h3>HTML</h3>
  
  <pre><code>&lt;h4 ng-cloak ng-hide="getDrawsWithResults(selectedLottery.draws)"&gt;Results of Selected Lottery&lt;/h4&gt;
  
  &lt;div class="con" ng-repeat="draw in getDrawsWithResults(selectedLottery.draws)" ng-cloak&gt;
      &lt;h5 class="con__header"&gt;[[ draw.date|date:'EEEE d MMMM yyyy - H:mm' ]]&lt;/h5&gt;
      &lt;div class="balls-list__outer con__row"&gt;
          &lt;div class="balls-list"&gt;
              &lt;div class="balls-list__ball__outer" ng-repeat="b in draw.results"&gt;
                  &lt;button class="balls-list__ball btn btn-con"&gt;[[ b ]]&lt;/button&gt;
              &lt;/div&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <h3>JS</h3>
  
  <pre><code>// return list of draws with results
  $scope.getDrawsWithResults = function(draws) {
      return _.filter(draws, function(draw){
          return draw.results &amp;&amp; draw.results.length &gt; 0;
      });
  }
  </code></pre>