• Overview
@angular/core

Injectable

decorator

Decorator that marks a class as available to be provided and injected as a dependency.

  
    @Injectable ({})
  
  

providedIn

Type<any> | "root" | "platform" | "any" | null | undefined

Determines which injectors will provide the injectable.

  • Type<any> - associates the injectable with an @NgModule or other InjectorType. This option is DEPRECATED.
  • 'null' : Equivalent to undefined. The injectable is not provided in any scope automatically and must be added to a providers array of an @NgModule, @Component or @Directive.

The following options specify that this injectable should be provided in one of the following injectors:

  • 'root' : The application-level injector in most apps.
  • 'platform' : A special singleton platform injector shared by all applications on the page.
  • 'any' : Provides a unique instance in each lazy loaded module while all eagerly loaded modules share one instance. This option is DEPRECATED.
Jump to details