* @ngdoc service * @name $rootScope * @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 model for chang
()
| 13707 | * {@link guide/scope developer guide on scopes}. |
| 13708 | */ |
| 13709 | function $RootScopeProvider() { |
| 13710 | var TTL = 10; |
| 13711 | var $rootScopeMinErr = minErr('$rootScope'); |
| 13712 | var lastDirtyWatch = null; |
| 13713 | var applyAsyncId = null; |
| 13714 | |
| 13715 | this.digestTtl = function(value) { |
| 13716 | if (arguments.length) { |
| 13717 | TTL = value; |
| 13718 | } |
| 13719 | return TTL; |
| 13720 | }; |
| 13721 | |
| 13722 | function createChildScopeClass(parent) { |
| 13723 | function ChildScope() { |
| 13724 | this.$$watchers = this.$$nextSibling = |
| 13725 | this.$$childHead = this.$$childTail = null; |
| 13726 | this.$$listeners = {}; |
| 13727 | this.$$listenerCount = {}; |
| 13728 | this.$id = nextUid(); |
| 13729 | this.$$ChildScope = null; |
| 13730 | } |
| 13731 | ChildScope.prototype = parent; |
| 13732 | return ChildScope; |
| 13733 | } |
| 13734 | |
| 13735 | this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser', |
| 13736 | function($injector, $exceptionHandler, $parse, $browser) { |
| 13737 | |
| 13738 | function destroyChildScope($event) { |
| 13739 | $event.currentScope.$$destroyed = true; |
| 13740 | } |
| 13741 | |
| 13742 | /** |
| 13743 | * @ngdoc type |
| 13744 | * @name $rootScope.Scope |
| 13745 | * |
| 13746 | * @description |
| 13747 | * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the |
| 13748 | * {@link auto.$injector $injector}. Child scopes are created using the |
| 13749 | * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when |
| 13750 | * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for |
| 13751 | * an in-depth introduction and usage examples. |
| 13752 | * |
| 13753 | * |
| 13754 | * # Inheritance |
| 13755 | * A scope can inherit from a parent scope, as in this example: |
| 13756 | * ```js |
| 13757 | var parent = $rootScope; |
| 13758 | var child = parent.$new(); |
| 13759 | |
| 13760 | parent.salutation = "Hello"; |
| 13761 | expect(child.salutation).toEqual('Hello'); |
| 13762 | |
| 13763 | child.salutation = "Welcome"; |
| 13764 | expect(child.salutation).toEqual('Welcome'); |
| 13765 | expect(parent.salutation).toEqual('Hello'); |
| 13766 | * ``` |
nothing calls this directly
no test coverage detected