auto.$provide.service()

service(name, constructor); Register a service constructor, which will be invoked with new to create the service instance. This is short for registering a service where its provider's $get property is a factory function that returns an instance instantiated by the injector from the service constructor function. Internally it looks a bit like this: { $get: function() { return $injector.instantiate(constructor); } } You should use $provide.service(class) if you define your service as a

auto.$provide.provider()

provider(name, provider); Register a provider function with the $injector. Provider functions are constructor functions, whose instances are responsible for "providing" a factory for a service. Service provider names start with the name of the service they provide followed by Provider. For example, the $log service has a provider called $logProvider. Service provider objects can have additional methods which allow configuration of the provider and its service. Importantly, you can configure wh

auto.$provide.factory()

factory(name, $getFn); Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. Parameters Param Type Details name string The name of the instance. $getFn function()Array.<(string|function())> The injectable $getFn for

auto.$provide.decorator()

decorator(name, decorator); Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behavior of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. Parameters Param Type Details name string The name of the service to decorate. decorator function()Array.<(string|function())> Th

auto.$provide.constant()

constant(name, value); Register a constant service with the $injector, such as a string, a number, an array, an object or a function. Like the value, it is not possible to inject other services into a constant. But unlike value, a constant can be injected into a module configuration function (see angular.Module) and it cannot be overridden by an Angular decorator. Parameters Param Type Details name string The name of the constant. value * The constant value. Returns Object regi

auto.$injector.invoke()

invoke(fn, [self], [locals]); Invoke the method and supply the method arguments from the $injector. Parameters Param Type Details fn function()Array.<(string|function())> The injectable function to invoke. Function parameters are injected according to the $inject Annotation rules. self (optional) Object The this for the invoked method. locals (optional) Object Optional object. If preset then any argument names are read from this object first, before the $injector is con

auto.$injector.instantiate()

instantiate(Type, [locals]); Create a new instance of JS type. The method takes a constructor function, invokes the new operator, and supplies all of the arguments to the constructor function as specified by the constructor annotation. Parameters Param Type Details Type Function Annotated constructor function. locals (optional) Object Optional object. If preset then any argument names are read from this object first, before the $injector is consulted. Returns Object new instanc

auto.$injector.has()

has(name); Allows the user to query if the particular service exists. Parameters Param Type Details name string Name of the service to query. Returns boolean true if injector has given service.

auto.$injector.get()

get(name, [caller]); Return an instance of the service. Parameters Param Type Details name string The name of the instance to retrieve. caller (optional) string An optional string to provide the origin of the function call for error messages. Returns * The instance.

auto.$injector.annotate()

annotate(fn, [strictDi]); Returns an array of service names which the function is requesting for injection. This API is used by the injector to determine which services need to be injected into the function when the function is invoked. There are three ways in which the function can be annotated with the needed dependencies. Argument names The simplest form is to extract the dependencies from the arguments of the function. This is done by converting the function into a string using toString()