title: angularjs directive: $rootScope:infdig error
body: <p>I'm trying to build a pagination directive with angularjs 1.2.15:  </p>
  
  <p>This is my view:</p>
  
  <pre><code>&lt;input type="text" ng-model="filter.user"&gt;
  &lt;input type="number" ng-model="filter.limit" ng-init="filter.limit=5"&gt;
  &lt;ul&gt;
    &lt;li ng-repeat="user in (filteredUsers = (users | orderBy:order:reverse | filter:filter.user ) | limitTo: filter.limit)" ng-click="showDetails(user)"&gt;
      {{user.id}} / {{user.firstname}} {{user.lastname}}
    &lt;/li&gt;
  &lt;/ul&gt;
  &lt;div pagination data='filteredUsers' limit='filter.limit'&gt;&lt;/div&gt;
  </code></pre>
  
  <p>and here is my pagination directive:</p>
  
  <pre><code>app.directive('pagination', function(){
    return {
      restrict: 'A',
      templateUrl: 'partials/pagination.html',
      scope: {
        data: '=data',
        limit: '=limit'
      }
    }
  })
  </code></pre>
  
  <p>Everything works perfectly fine without the pagination directive. However with my new directive as soon as I load the page I get a <code>$rootScope:infdig</code> error which I don't understand since the directive is not doing anything to manipulate data that could end up in an infinite loop.<br>
  What is the problem here and how can I solve it? Thanks!</p>
  
  <p><strong>Update:</strong><br>
  Here are the controller and the resource.<br>
  Controller:</p>
  
  <pre><code>usersModule.controller('usersController',
    function ($scope, Users) {
      function init(){
        $scope.users = Users.get();
      }
      init();
  })
  </code></pre>
  
  <p>Resource (gets users as an array from a REST API):</p>
  
  <pre><code>app.factory('Users', function($resource) {
    return $resource('http://myrestapi.tld/users', null,{
         'get': { method:'GET', isArray: true, cache: true }
     });
  });
  </code></pre>
  
  <p><strong>Update 2</strong></p>
  
  <p>Here is a demo: <a href="http://plnkr.co/edit/9GCE3Kzf21a7l10GFPmy?p=preview" rel="noreferrer">http://plnkr.co/edit/9GCE3Kzf21a7l10GFPmy?p=preview</a><br>
  Just type in a letter (e.g. "f") into the left input.</p>