Download angularjs eBook


  • constant(name, value);
  • value(name, value);
  • factory(name, $getFn);
  • service(name, constructor);
  • provider(name, provider);


Providers are singleton objects that can be injected, for example, into other services, controllers and directives. All providers are registered using different "recipes", where Provider is the most flexible one. All possible recipes are:

  • Constant
  • Value
  • Factory
  • Service
  • Provider

Services, Factories and Providers are all lazy initialized, component is initialized only if application depends on it.

Decorators are closely related to Providers. Decorators are used to intercept service or factory creation in order to change it's behavior or override (parts of) it.

Related Examples


203 Contributors: 1
Friday, September 23, 2016
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial:

Download eBook