Reached '10 $ digest () iterations. aborting 'using ngTemplate and ngInclude for nested comments

HTML

<script type="text/ng-template" id="commentTree">
    {{ child.body }}
    <ul class='list-group' ng-if="child.children">
        <li class='list-group-item' ng-repeat="child in child.children" ng-include="'commentTree'">
        </li>
    </ul>
    <span ng-click="formReply(child)">Reply</span>
</script>

<ul class='list-group'>
    <li class='list-group-item' ng-repeat="child in children" ng-include="'commentTree'"></li>
</ul>

Im uses ngTemplateand ngIncludeto create nested comments. However, as soon as the thread reaches 10 nested responses, if the console is open, I get the following error.

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

What are the possible workarounds available to me? Is this html only in my status template if I include it in a directive that helps?

+4
source share

Source: https://habr.com/ru/post/1621665/


All Articles