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 what kind of service is created by the $get
method, or how that service will act. For example, the $logProvider has a method debugEnabled which lets you specify whether the $log service will log debug messages to the console or not.
Parameters
Param | Type | Details |
---|---|---|
name | string | The name of the instance. NOTE: the provider will be available under |
provider | Object function() | If the provider is:
|
Returns
Object |
registered provider instance |
Please login to continue.