You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/content/error/rootScope/infdig.ngdoc
+5-2
Original file line number
Diff line number
Diff line change
@@ -3,12 +3,15 @@
3
3
@fullName Infinite $digest Loop
4
4
@description
5
5
6
-
This error occurs when the application's model becomes unstable and each `$digest` cycle triggers a state change and subsequent `$digest` cycle. Angular detects this situation and prevents an infinite loop from causing the browser to become unresponsive.
6
+
This error occurs when the application's model becomes unstable and each `$digest` cycle triggers a state change and subsequent `$digest` cycle.
7
+
Angular detects this situation and prevents an infinite loop from causing the browser to become unresponsive.
7
8
8
9
For example, the situation can occur by setting up a watch on a path and subsequently updating the same path when the value changes.
9
10
10
11
```
11
12
$scope.$watch('foo', function() {
12
13
$scope.foo = $scope.foo + 1;
13
14
});
14
-
```
15
+
```
16
+
17
+
The maximum number of allowed iterations of the `$digest` cycle is controlled via TTL setting which can be configured via {@link api/ng.$rootScopeProvider $rootScopeProvider}.
Copy file name to clipboardExpand all lines: src/ng/rootScope.js
+6-2
Original file line number
Diff line number
Diff line change
@@ -40,11 +40,15 @@
40
40
* @methodOf ng.$rootScopeProvider
41
41
* @description
42
42
*
43
-
* Sets the number of digest iterations the scope should attempt to execute before giving up and
44
-
* assuming that the model is unstable.
43
+
* Sets the number of `$digest` iterations the scope should attempt to execute before giving up and assuming that the model is unstable.
45
44
*
46
45
* The current default is 10 iterations.
47
46
*
47
+
* In complex applications it's possible that the dependencies between `$watch`s will result in several digest iterations.
48
+
* However if an application needs more than the default 10 digest iterations for its model to stabilize then you should investigate what is causing the model to continuously change during the digest.
49
+
*
50
+
* Increasing the TTL could have performance implications, so you should not change it without proper justification.
51
+
*
48
52
* @param {number} limit The number of digest iterations.
0 commit comments