title: template recursion limitation (digest loop) in angularjs
body: <p>I use recursive templates to render a tree in angularJS, but when tree depth is above 10, AngularJS gives me an error on the console saying:</p>
  
  <pre><code>"Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
  </code></pre>
  
  <p>Example in <a href="http://plnkr.co/edit/eUG7E6wmn0QV94sPWpfN?p=preview" rel="nofollow">this plnkr</a>.</p>
  
  <p>If I understand correctly and try to put simple words on it (I know it's more complex): </p>
  
  <ul>
  <li>in the first $digest() iteration, it includes the first template and thus creates a ŵatcher over <code>item</code> (actually on <code>item.ID</code> and <code>item.children</code></li>
  <li>then instead of including the template recursively and create watchers afterwards, it first wants to check item.children, and reruns the digest loop with <code>--ttl</code></li>
  <li>then both values are the same, so it goes on and includes the next template and sets a watcher on the new <code>item</code>, and goes back to second step</li>
  </ul>
  
  <p>Thus after 10 iterations, the ttl will be 0, hence the error, though there is no actual error...</p>
  
  <p>So, a few questions:</p>
  
  <ul>
  <li>is my analysis correct?</li>
  <li>should I report this on the angular tracker (as I believe angular is wrong in reporting an error)?</li>
  <li>is there a simple workaround?</li>
  </ul>
  
  <p>Thank you very much!</p>
  
  <p><strong>Edit:</strong></p>
  
  <p><a href="http://plnkr.co/edit/X1grV8MGBPErLJQ2p7ah?p=preview" rel="nofollow">This plnkr</a> (which you need to see with firefox because of a raw.github) shows that bindonce is not a solution to this...</p>