* @ngdoc service * @name $rootScope * @this * * @description * * Every application has a single root ng.$rootScope.Scope scope. * All other scopes are descendant scopes of the root scope. Scopes provide separation * between the model and the view, via a mechanism for watching the mod
()
| 17087 | * {@link guide/scope developer guide on scopes}. |
| 17088 | */ |
| 17089 | function $RootScopeProvider() { |
| 17090 | var TTL = 10; |
| 17091 | var $rootScopeMinErr = minErr('$rootScope'); |
| 17092 | var lastDirtyWatch = null; |
| 17093 | var applyAsyncId = null; |
| 17094 | |
| 17095 | this.digestTtl = function(value) { |
| 17096 | if (arguments.length) { |
| 17097 | TTL = value; |
| 17098 | } |
| 17099 | return TTL; |
| 17100 | }; |
| 17101 | |
| 17102 | function createChildScopeClass(parent) { |
| 17103 | function ChildScope() { |
| 17104 | this.$$watchers = this.$$nextSibling = |
| 17105 | this.$$childHead = this.$$childTail = null; |
| 17106 | this.$$listeners = {}; |
| 17107 | this.$$listenerCount = {}; |
| 17108 | this.$$watchersCount = 0; |
| 17109 | this.$id = nextUid(); |
| 17110 | this.$$ChildScope = null; |
| 17111 | } |
| 17112 | ChildScope.prototype = parent; |
| 17113 | return ChildScope; |
| 17114 | } |
| 17115 | |
| 17116 | this.$get = ['$exceptionHandler', '$parse', '$browser', |
| 17117 | function($exceptionHandler, $parse, $browser) { |
| 17118 | |
| 17119 | function destroyChildScope($event) { |
| 17120 | $event.currentScope.$$destroyed = true; |
| 17121 | } |
| 17122 | |
| 17123 | function cleanUpScope($scope) { |
| 17124 | |
| 17125 | if (msie === 9) { |
| 17126 | // There is a memory leak in IE9 if all child scopes are not disconnected |
| 17127 | // completely when a scope is destroyed. So this code will recurse up through |
| 17128 | // all this scopes children |
| 17129 | // |
| 17130 | // See issue https://github.com/angular/angular.js/issues/10706 |
| 17131 | if ($scope.$$childHead) { |
| 17132 | cleanUpScope($scope.$$childHead); |
| 17133 | } |
| 17134 | if ($scope.$$nextSibling) { |
| 17135 | cleanUpScope($scope.$$nextSibling); |
| 17136 | } |
| 17137 | } |
| 17138 | |
| 17139 | // The code below works around IE9 and V8's memory leaks |
| 17140 | // |
| 17141 | // See: |
| 17142 | // - https://code.google.com/p/v8/issues/detail?id=2073#c26 |
| 17143 | // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909 |
| 17144 | // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451 |
| 17145 | |
| 17146 | $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead = |
nothing calls this directly
no test coverage detected