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

433 Views Asked by At

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 using ngTemplate and ngInclude to render nested comments. However as soon as a thread reaches 10 nested replies, if the console is open I get the following error.

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

What possible workarounds are available to me? This html is just in my state template, if I turn it into a directive would that help?

0

There are 0 best solutions below