value(name, value);
Register a value service with the $injector, such as a string, a number, an array, an object or a function. This is short for registering a service where its provider's $get
property is a factory function that takes no arguments and returns the value service. That also means it is not possible to inject other services into a value service.
Value services are similar to constant services, except that they cannot be injected into a module configuration function (see angular.Module
) but they can be overridden by an Angular decorator.
Parameters
Param | Type | Details |
---|---|---|
name | string | The name of the instance. |
value | * | The value. |
Returns
Object |
registered provider instance |
Please login to continue.