I get the following error in Angularjs:
"Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [["fn: parentValueWatch; newVal: {\"x\":0,\"y\":0}; oldVal: {\"x\":0,\"y\":0}"],["fn: parentValueWatch; newVal: {\"x\":0,\"y\":0}; oldVal: {\"x\":0,\"y\":0}"],["fn: parentValueWatch; newVal: {\"x\":0,\"y\":0}; oldVal: {\"x\":0,\"y\":0}"],["fn: parentValueWatch; newVal: {\"x\":0,\"y\":0}; oldVal: {\"x\":0,\"y\":0}"],["fn: parentValueWatch; newVal: {\"x\":0,\"y\":0}; oldVal: {\"x\":0,\"y\":0}"]]
The newVal
and oldVal
logs are all the same. According to How to Troubleshoot Angular "10 $digest() iterations reached" Error, the error should be thrown when the value changes.
This is my app code:
$scope.getCommentLocation = function(comment) {
console.log("TEST");
if (comment == undefined) { // This is all that gets returned every time
return {
x: 0,
y: 0
};
}
$range = getRangeObjectForComment(comment);
position = $range.offset();
window_position_y = position.top - $('#main-text_ifr').contents().find('body').scrollTop() + frameposition.top + $range.height() / 2;
window_position_x = position.left + frameposition.left + $range.width() / 2;
return {
x: window_position_x,
y: window_position_y
};
};
This is the jade code (Jade is an html template language):
location="getCommentLocation(commentEditor.activeComment)"