Skip to content Skip to sidebar Skip to footer

AngularJS V1.2.x $digest() Infinite Loop Directive Isolated Scope Object Param

Simplified version of problem, view web dev console: http://plnkr.co/edit/3wKmWz?p=preview Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! Watchers f

Solution 1:

This is because you're passing in a function as a 2 way binding into the directive, which is not what you should be doing, either pass an object using 2 way binding:

scope: { breakingObject: '=' },

<div test-dir breaking-object="ctrlObjReturnFn"></div>

$scope.ctrlObjReturnFn =  {test:true};

or a function using 1 way binding:

scope: { breakingObject: '&' },

<div test-dir breaking-object="ctrlObjReturnFn()"></div>

$scope.ctrlObjReturnFn = function() {
   return {test:true};
}

See plunk.


Post a Comment for "AngularJS V1.2.x $digest() Infinite Loop Directive Isolated Scope Object Param"