MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / $RootScopeProvider

Function $RootScopeProvider

code/songhop/www/lib/angular/angular.js:13493–14752  ·  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

13491 * {@link guide/scope developer guide on scopes}.
13492 */
13493function $RootScopeProvider() {
13494 var TTL = 10;
13495 var $rootScopeMinErr = minErr('$rootScope');
13496 var lastDirtyWatch = null;
13497 var applyAsyncId = null;
13498
13499 this.digestTtl = function(value) {
13500 if (arguments.length) {
13501 TTL = value;
13502 }
13503 return TTL;
13504 };
13505
13506 this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser',
13507 function($injector, $exceptionHandler, $parse, $browser) {
13508
13509 /**
13510 * @ngdoc type
13511 * @name $rootScope.Scope
13512 *
13513 * @description
13514 * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the
13515 * {@link auto.$injector $injector}. Child scopes are created using the
13516 * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when
13517 * compiled HTML template is executed.)
13518 *
13519 * Here is a simple scope snippet to show how you can interact with the scope.
13520 * ```html
13521 * <file src="./test/ng/rootScopeSpec.js" tag="docs1" />
13522 * ```
13523 *
13524 * # Inheritance
13525 * A scope can inherit from a parent scope, as in this example:
13526 * ```js
13527 var parent = $rootScope;
13528 var child = parent.$new();
13529
13530 parent.salutation = "Hello";
13531 child.name = "World";
13532 expect(child.salutation).toEqual('Hello');
13533
13534 child.salutation = "Welcome";
13535 expect(child.salutation).toEqual('Welcome');
13536 expect(parent.salutation).toEqual('Hello');
13537 * ```
13538 *
13539 * When interacting with `Scope` in tests, additional helper methods are available on the
13540 * instances of `Scope` type. See {@link ngMock.$rootScope.Scope ngMock Scope} for additional
13541 * details.
13542 *
13543 *
13544 * @param {Object.<string, function()>=} providers Map of service factory which need to be
13545 * provided for the current scope. Defaults to {@link ng}.
13546 * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should
13547 * append/override services provided by `providers`. This is handy
13548 * when unit-testing and having the need to override a default
13549 * service.
13550 * @returns {Object} Newly created scope.

Callers

nothing calls this directly

Calls 15

getMethod · 0.80
minErrFunction · 0.70
nextUidFunction · 0.70
isFunctionFunction · 0.70
arrayRemoveFunction · 0.70
listenerFunction · 0.70
forEachFunction · 0.70
beginPhaseFunction · 0.70
flushApplyAsyncFunction · 0.70
equalsFunction · 0.70
copyFunction · 0.70
clearPhaseFunction · 0.70

Tested by

no test coverage detected