Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 2331e4d

Browse files
fix($rootScope): handle cyclic references in scopes when creating error messages
Use the new private function `stringify` to convert scope values to strings, since this can cope with cyclic references and other oddities.
1 parent 4be940b commit 2331e4d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ng/rootScope.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ function $RootScopeProvider() {
776776
logMsg = (isFunction(watch.exp))
777777
? 'fn: ' + (watch.exp.name || watch.exp.toString())
778778
: watch.exp;
779-
logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last);
779+
logMsg += '; newVal: ' + stringify(value) + '; oldVal: ' + stringify(last);
780780
watchLog[logIdx].push(logMsg);
781781
}
782782
} else if (watch === lastDirtyWatch) {
@@ -810,7 +810,7 @@ function $RootScopeProvider() {
810810
throw $rootScopeMinErr('infdig',
811811
'{0} $digest() iterations reached. Aborting!\n' +
812812
'Watchers fired in the last 5 iterations: {1}',
813-
TTL, toJson(watchLog));
813+
TTL, watchLog);
814814
}
815815

816816
} while (dirty || asyncQueue.length);

0 commit comments

Comments
 (0)