* @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
()
| 17573 | * {@link guide/scope developer guide on scopes}. |
| 17574 | */ |
| 17575 | function $RootScopeProvider() { |
| 17576 | var TTL = 10; |
| 17577 | var $rootScopeMinErr = minErr('$rootScope'); |
| 17578 | var lastDirtyWatch = null; |
| 17579 | var applyAsyncId = null; |
| 17580 | |
| 17581 | this.digestTtl = function(value) { |
| 17582 | if (arguments.length) { |
| 17583 | TTL = value; |
| 17584 | } |
| 17585 | return TTL; |
| 17586 | }; |
| 17587 | |
| 17588 | function createChildScopeClass(parent) { |
| 17589 | function ChildScope() { |
| 17590 | this.$$watchers = this.$$nextSibling = |
| 17591 | this.$$childHead = this.$$childTail = null; |
| 17592 | this.$$listeners = {}; |
| 17593 | this.$$listenerCount = {}; |
| 17594 | this.$$watchersCount = 0; |
| 17595 | this.$id = nextUid(); |
| 17596 | this.$$ChildScope = null; |
| 17597 | } |
| 17598 | ChildScope.prototype = parent; |
| 17599 | return ChildScope; |
| 17600 | } |
| 17601 | |
| 17602 | this.$get = ['$exceptionHandler', '$parse', '$browser', |
| 17603 | function($exceptionHandler, $parse, $browser) { |
| 17604 | |
| 17605 | function destroyChildScope($event) { |
| 17606 | $event.currentScope.$$destroyed = true; |
| 17607 | } |
| 17608 | |
| 17609 | function cleanUpScope($scope) { |
| 17610 | |
| 17611 | // Support: IE 9 only |
| 17612 | if (msie === 9) { |
| 17613 | // There is a memory leak in IE9 if all child scopes are not disconnected |
| 17614 | // completely when a scope is destroyed. So this code will recurse up through |
| 17615 | // all this scopes children |
| 17616 | // |
| 17617 | // See issue https://github.com/angular/angular.js/issues/10706 |
| 17618 | if ($scope.$$childHead) { |
| 17619 | cleanUpScope($scope.$$childHead); |
| 17620 | } |
| 17621 | if ($scope.$$nextSibling) { |
| 17622 | cleanUpScope($scope.$$nextSibling); |
| 17623 | } |
| 17624 | } |
| 17625 | |
| 17626 | // The code below works around IE9 and V8's memory leaks |
| 17627 | // |
| 17628 | // See: |
| 17629 | // - https://code.google.com/p/v8/issues/detail?id=2073#c26 |
| 17630 | // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909 |
| 17631 | // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451 |
| 17632 |
nothing calls this directly
no test coverage detected