MCPcopy Create free account
hub / github.com/cafebazaar/blacksmith / $RootScopeProvider

Function $RootScopeProvider

web/static/bower_components/angular/angular.js:15118–16397  ·  view source on GitHub ↗

* @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

()

Source from the content-addressed store, hash-verified

15116 * {@link guide/scope developer guide on scopes}.
15117 */
15118function $RootScopeProvider() {
15119 var TTL = 10;
15120 var $rootScopeMinErr = minErr('$rootScope');
15121 var lastDirtyWatch = null;
15122 var applyAsyncId = null;
15123
15124 this.digestTtl = function(value) {
15125 if (arguments.length) {
15126 TTL = value;
15127 }
15128 return TTL;
15129 };
15130
15131 function createChildScopeClass(parent) {
15132 function ChildScope() {
15133 this.$$watchers = this.$$nextSibling =
15134 this.$$childHead = this.$$childTail = null;
15135 this.$$listeners = {};
15136 this.$$listenerCount = {};
15137 this.$$watchersCount = 0;
15138 this.$id = nextUid();
15139 this.$$ChildScope = null;
15140 }
15141 ChildScope.prototype = parent;
15142 return ChildScope;
15143 }
15144
15145 this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser',
15146 function($injector, $exceptionHandler, $parse, $browser) {
15147
15148 function destroyChildScope($event) {
15149 $event.currentScope.$$destroyed = true;
15150 }
15151
15152 /**
15153 * @ngdoc type
15154 * @name $rootScope.Scope
15155 *
15156 * @description
15157 * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the
15158 * {@link auto.$injector $injector}. Child scopes are created using the
15159 * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when
15160 * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for
15161 * an in-depth introduction and usage examples.
15162 *
15163 *
15164 * # Inheritance
15165 * A scope can inherit from a parent scope, as in this example:
15166 * ```js
15167 var parent = $rootScope;
15168 var child = parent.$new();
15169
15170 parent.salutation = "Hello";
15171 expect(child.salutation).toEqual('Hello');
15172
15173 child.salutation = "Welcome";
15174 expect(child.salutation).toEqual('Welcome');
15175 expect(parent.salutation).toEqual('Hello');

Callers

nothing calls this directly

Calls 15

minErrFunction · 0.85
createChildScopeClassFunction · 0.85
isFunctionFunction · 0.85
incrementWatchersCountFunction · 0.85
arrayRemoveFunction · 0.85
listenerFunction · 0.85
forEachFunction · 0.85
beginPhaseFunction · 0.85
flushApplyAsyncFunction · 0.85
equalsFunction · 0.85
copyFunction · 0.85
clearPhaseFunction · 0.85

Tested by

no test coverage detected