$rootScope.Scope.$emit()

$emit(name, args); Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners. The event life cycle starts at the scope on which $emit was called. All listeners listening for name event on this scope get notified. Afterwards, the event traverses upwards toward the root scope and calls all registered listeners along the way. The event will stop propagating if one of the listeners cancels it. Any exception emitted from the listeners will be p

$rootScope.Scope.$digest()

$digest(); Processes all of the watchers of the current scope and its children. Because a watcher's listener can change the model, the $digest() keeps calling the watchers until no more listeners are firing. This means that it is possible to get into an infinite loop. This function will throw 'Maximum iteration limit exceeded.' if the number of iterations exceeds 10. Usually, you don't call $digest() directly in controllers or in directives. Instead, you should call $apply() (typically from wi

$rootScope.Scope.$destroy()

$destroy(); Removes the current scope (and all of its children) from the parent scope. Removal implies that calls to $digest() will no longer propagate to the current scope and its children. Removal also implies that the current scope is eligible for garbage collection. The $destroy() is usually used by directives such as ngRepeat for managing the unrolling of the loop. Just before a scope is destroyed, a $destroy event is broadcasted on this scope. Application code can register a $destroy eve

$rootScope.Scope.$broadcast()

$broadcast(name, args); Dispatches an event name downwards to all child scopes (and their children) notifying the registered $rootScope.Scope listeners. The event life cycle starts at the scope on which $broadcast was called. All listeners listening for name event on this scope get notified. Afterwards, the event propagates to all direct and indirect scopes of the current scope and calls all registered listeners along the way. The event cannot be canceled. Any exception emitted from the listen

$rootScope.Scope.$applyAsync()

$applyAsync([exp]); Schedule the invocation of $apply to occur at a later time. The actual time difference varies across browsers, but is typically around ~10 milliseconds. This can be used to queue up multiple expressions which need to be evaluated in the same digest. Parameters Param Type Details exp (optional) stringfunction() An angular expression to be executed. string: execute using the rules as defined in expression. function(scope): execute the function with current scope param

$rootScope.Scope.$apply()

$apply([exp]); $apply() is used to execute an expression in angular from outside of the angular framework. (For example from browser DOM events, setTimeout, XHR or third party libraries). Because we are calling into the angular framework we need to perform proper scope life cycle of exception handling, executing watches. Life cycle Pseudo-Code of $apply() function $apply(expr) { try { return $eval(expr); } catch (e) { $exceptionHandler(e); } finally { $root.$digest(); } }

$rootScope.Scope

type in module ng A root scope can be retrieved using the $rootScope key from the $injector. Child scopes are created using the $new() method. (Most scopes are created automatically when compiled HTML template is executed.) See also the Scopes guide for an in-depth introduction and usage examples. Inheritance A scope can inherit from a parent scope, as in this example: var parent = $rootScope; var child = parent.$new(); parent.salutation = "Hello"; expect(child.salutation).toEqual('Hello'

$rootScope

$rootScopeProvider service in module ng Every application has a single root 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 changes. They also provide event emission/broadcast and subscription facility. See the developer guide on scopes.

$rootElement

service in module ng The root element of Angular application. This is either the element where ngApp was declared or the element passed into angular.bootstrap. The element represents the root element of application. It is also the location where the application's $injector service gets published, and can be retrieved using $rootElement.injector().

$q.when()

when(value, [successCallback], [errorCallback], [progressCallback]); Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. Parameters Param Type Details value * Value or a promise successCallback (optional) Function= errorCallback (optional) Function= progressCallback (optional) Function