Guide: Dependency Injection

Dependency Injection (DI) is a software design pattern that deals with how components get hold of their dependencies. The Angular injector subsystem is in charge of creating components, resolving their dependencies, and providing them to other components as requested. Using Dependency Injection DI is pervasive throughout Angular. You can use it when defining components or when providing run and config blocks for a module. Components such as services, directives, filters, and animations are def

ngMockE2E

Installation First include angular-mocks.js in your HTML: <script src="angular.js"> <script src="angular-mocks.js"> You can download this file from the following places: Google CDN e.g. //ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-mocks.js Bower e.g. bower install angular-mocks@X.Y.Z code.angularjs.org e.g. "//code.angularjs.org/X.Y.Z/angular-mocks.js" where X.Y.Z is the AngularJS version you are running. Then load the module in your application by adding it as a

$parseProvider.addLiteral()

addLiteral(literalName, literalValue); Configure $parse service to add literal values that will be present as literal at expressions. Parameters Param Type Details literalName string Token for the literal value. The literal name value must be a valid literal name. literalValue * Value for this literal. All literal values must be primitives or undefined.

angular.Module.constant()

constant(name, object); Because the constants are fixed, they get applied before other provide methods. See $provide.constant(). Parameters Param Type Details name string constant name object * Constant value.

$animate.on()

on(event, container, callback); Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...) has fired on the given element or among any of its children. Once the listener is fired, the provided callback is fired with the following params: $animate.on('enter', container, function callback(element, phase) { // cool we detected an enter animation within the container } ); Parameters Param Type Details event string the animation event that will be

ngMock.$httpBackend.whenPUT()

whenPUT(url, [data], [headers], [keys]); Creates a new backend definition for PUT requests. For more info see when(). Parameters Param Type Details url stringRegExpfunction(string) HTTP url or function that receives a url and returns true if the url matches the current definition. data (optional) stringRegExpfunction(string) HTTP request body or function that receives data string and returns true if the data is as expected. headers (optional) Objectfunction(Object) HTTP heade

ngAnimate.ngAnimateChildren

directive in module ngAnimate ngAnimateChildren allows you to specify that children of this element should animate even if any of the children's parents are currently animating. By default, when an element has an active enter, leave, or move (structural) animation, child elements that also have an active structural animation are not animated. Note that even if ngAnimteChildren is set, no child animations will run when the parent element is removed from the DOM (leave animation). Directiv

ngMockE2E.$httpBackend.whenPATCH()

whenPATCH(url, [data], [headers], [keys]); Creates a new backend definition for PATCH requests. For more info see when(). Parameters Param Type Details url stringRegExpfunction(string) HTTP url or function that receives a url and returns true if the url matches the current definition. data (optional) stringRegExp HTTP request body. headers (optional) Objectfunction(Object) HTTP headers. keys (optional) Array Array of keys to assign to regex matches in request url descri

ngCookies.$cookiesProvider.defaults

defaults Object containing default options to pass when setting cookies. The object may have following properties: path - {string} - The cookie will be available only for this path and its sub-paths. By default, this is the URL that appears in your <base> tag. domain - {string} - The cookie will be available only for this domain and its sub-domains. For security reasons the user agent will not accept the cookie if the current domain is not a sub-domain of this domain or equal to it.

ngMock.$httpBackend.whenRoute()

whenRoute(method, url); Creates a new backend definition that compares only with the requested route. Parameters Param Type Details method string HTTP method. url string HTTP url string that supports colon param matching. Returns requestHandler Returns an object with respond method that controls how a matched request is handled. You can save this object for later use and invoke respond again in order to change how a matched request is handled. See #when for more info.