title: Angular precedence of ng-repeat with filter and ng-if on the same element
body: <p>If there's a <strong>ng-if</strong> and a <strong>ng-repeat</strong> with a filter on the same element the filter gets called once even if the <strong>ng-if</strong> is hiding the element.</p>
  
  <pre class="lang-js prettyprint-override"><code>var app = angular.module('plunker', []);
  
  app.controller('MainCtrl', function($scope, $timeout) {
    $timeout(function() {
      $scope.list = [1, 2, 3, 4, 5, 6, 7, 8, 9];
    }, 2000);
  });
  
  app.filter('crashyFilter', function() {
    return function(list) {
      return list.map(function(item) {
        return item + 1;
      });
    };
  });
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code>&lt;body ng-controller="MainCtrl"&gt;
    &lt;div ng-if="list" ng-repeat="item in list | crashyFilter"&gt;
      {{item}}
    &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  
  
  <p>In the browser console you can see that the map call fails once because the list parameter is undefined. I made a plunker with it <a href="http://plnkr.co/edit/g4JMfGDHXHYcNSguwirJ?p=preview" rel="nofollow">here</a>.</p>
  
  <p>Anyone knows why this is happening?</p>