This is the archived documentation for Angular v6. Please visit angular.io to see documentation for the current version of Angular.

inject

inject<T>(token: Type<T> | InjectionToken<T>, flags: InjectFlags.Default = InjectFlags.Default): T | null
      
      inject<T>(token: Type<T> | InjectionToken<T>, flags: InjectFlags.Default = InjectFlags.Default): T | null
    

Parameters

token

Type: Type | InjectionToken.

flags

Type: InjectFlags.Default.

Optional. Default is InjectFlags.Default.

Returns

T | null