title: AngularJS increment value for id attributes
body: <p>I have some html that looks like this:</p>
  
  <pre><code>&lt;tr ng-repeat="x in y"&gt;
      &lt;td&gt;
           &lt;div ng-attr-id="{{getId()}}"&gt;&lt;/div&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;div ng-attr-id="{{getId()}}"&gt;&lt;/div&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;div ng-attr-id="{{getId()}}"&gt;&lt;/div&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I want to have an id that starts from 1 for the first <code>&lt;td&gt;</code> element and then increments one for each <code>&lt;td&gt;</code> element.</p>
  
  <p>By doing in the controller:</p>
  
  <pre><code>$scope.getId = function () {
      counter++;
      return counter;
  }
  </code></pre>
  
  <p>I get </p>
  
  <blockquote>
    <p>10 $digest() iterations reached. Aborting!</p>
  </blockquote>