How to fix “10 $digest() iterations reached. Aborting!” error in Angular 1.5 Components?

Viewed 2232

I am writing a angular component in recursive way to display a json as tree. It works, but Aborts showing "Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations"

Component Template:

jsonTree.html:(recursive)

<span>{{$ctrl.key}}</span>
<span ng-if="!$ctrl.isExpandable">{{$ctrl.value}}</span>
<ul ng-if="$ctrl.isExpandable">
  <li ng-repeat="(subkey,subval) in $ctrl.value">
    <json-tree key="subkey" value="subval"></json-tree>
  </li>
</ul>

Component JS:

myModule.component ('jsonTree',
    bindings: {key:"<",value:"<"}
    templateUrl: "jsonTree.html");
0 Answers
Related