Hi!

Had the sane 
issue: 
http://stackoverflow.com/questions/32647286/recursive-ng-include-throws-10-digest-iterations-reached#32647286
The valid workaround is this:

angular.module('myApp',[]).config(function($rootScopeProvider) {
    $rootScopeProvider.digestTtl(number); //some number bigger then 10})


On Friday, March 20, 2015 at 11:35:23 AM UTC+3, Vladimir Gorshunov wrote:
>
> How did you fix this? Also stucked with this problem
>
> On Wednesday, January 23, 2013 at 2:59:55 AM UTC+3, AndrewM wrote:
>>
>> I tried a solution similar to what you are proposing without any luck. 
>> See the fiddle here for the crash using the directive method: 
>> http://jsfiddle.net/imagio/Zwq8e/
>>
>> Actually, I based my fiddle on angular batarang's recursive tree 
>> directive here: 
>> https://github.com/angular/angularjs-batarang/blob/master/js/directives/modelTree.js
>>
>> I am out of ideas as to how to solve this problem. It seems that either 
>> deep tree rendering is impossible by design or that this is a bug/corner 
>> case with angular.
>>
>> Any more ideas?
>>
>> Thanks
>>
>> On Tuesday, January 22, 2013 3:45:50 PM UTC-5, Marco Rinck wrote:
>>>
>>> Andrew,
>>>
>>> Hmm, I wanted to write some pseudo-code to make myself clear. 
>>> Unfortunately that only resulted in that I think that its not as easy as I 
>>> thought at first glance. Damn it :-) 
>>>
>>> But the directive approach could still work if a directive can build the 
>>> output and include itself for. Something like recursive directives. I don't 
>>> know if that would work, haven't tested that. 
>>>
>>> In pseudo-code it would look like this: 
>>>
>>> In your html: 
>>> <comment-directive comments="controller.comments" />
>>>
>>>  
>>> And the template of the directive: 
>>> <ul>
>>>   <li ng-repeat="comment in comments">
>>>       {{comment.author}} {{comment.date}} 
>>>       {{comment.text}}
>>>       <div ng-show="comment.hasSubComments()">
>>>           <comment-directive comments="comment.subComments" />
>>>      </div>
>>>   </li>
>>> </ul>
>>>
>>> But as I said, I haven't tested that. 
>>>
>>> Marco
>>>
>>> Am Dienstag, 22. Januar 2013 21:28:30 UTC+1 schrieb AndrewM:
>>>>
>>>> Hi Marco,
>>>>
>>>> Could you elaborate on what you mean by using a directive to loop over 
>>>> the comments and display them? Does a directive somehow prevent the 
>>>> digests 
>>>> caused by ng-reapeat from happening? I will still have more than 9 levels 
>>>> of nesting regardless (could have 100, it is an arbitrary amount set by 
>>>> user behavior). 
>>>>
>>>> Thanks
>>>>
>>>> On Tuesday, January 22, 2013 2:46:16 PM UTC-5, Marco Rinck wrote:
>>>>>
>>>>> Hi Andrew, 
>>>>>
>>>>> I think this error is a safety net by the angular devs to prevent an 
>>>>> infinite loop of digests. In any normal application there should ALWAYS 
>>>>> be 
>>>>> a way around this limitation.  
>>>>>
>>>>> You should implement your comments as an directive and loop over your 
>>>>> comments and use the directive to display them.    
>>>>>
>>>>> Marco
>>>>>
>>>>> Am Dienstag, 22. Januar 2013 20:13:52 UTC+1 schrieb AndrewM:
>>>>>>
>>>>>> I have an app in which I am trying to display a nested comments 
>>>>>> thread. This thread of comments is in a tree structure and may be 
>>>>>> arbitrarily deep. To accomplish this I am using ng-repeat on a template 
>>>>>> which uses ng-include to recursively render itself. 
>>>>>>
>>>>>> The problem is that once any comments thread gets to a depth > 9 
>>>>>> angularjs crashes with "Error: 10 $digest() iterations reached. 
>>>>>> Aborting!". 
>>>>>>
>>>>>> Is my method of rendering an arbitrary depth tree wrong? I think that 
>>>>>> tree rendering must be a common pattern but I cannot find other examples 
>>>>>> of 
>>>>>> this error being thrown due to tree depth and recursive ng-include.
>>>>>>
>>>>>> See this fiddle for a simplified example of the bug/problem: 
>>>>>> http://jsfiddle.net/imagio/qwUYK/9/
>>>>>> If the 10th level of nested data is removed the exmaple runs. Add the 
>>>>>> 10th level of nested data back in and the console will spit out "Error: 
>>>>>> 10 
>>>>>> $digest() iterations reached. Aborting!". 
>>>>>>
>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to