Elie Roux
Elie Roux

Reputation: 455

template recursion limitation (digest loop) in angularjs

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:

"Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!

Example in this plnkr.

If I understand correctly and try to put simple words on it (I know it's more complex):

Thus after 10 iterations, the ttl will be 0, hence the error, though there is no actual error...

So, a few questions:

Thank you very much!

Edit:

This plnkr (which you need to see with firefox because of a raw.github) shows that bindonce is not a solution to this...

Upvotes: 5

Views: 1856

Answers (2)

Elie Roux
Elie Roux

Reputation: 455

This is apparently a known issue of AngularJS, the only workarounds are not really satisfactory, See this issue.

Upvotes: 4

Elie Roux
Elie Roux

Reputation: 455

In a since deleted (why?) comment, someone has pointed me to this thread where there is a workaround if the depth is known. This plnkr show it at work. This is not satisfactory, but it's one possible answer...

Upvotes: 1

Related Questions