EnvironmentInjector
class
developer preview
An Injector
that's part of the environment injector hierarchy, which exists outside of the component tree.
abstract class EnvironmentInjector implements Injector { abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T abstract destroy(): void }
Methods
get()
|
|||||||||
---|---|---|---|---|---|---|---|---|---|
Retrieves an instance from the injector based on the provided token. |
|||||||||
|
token |
ProviderToken<T> |
|
notFoundValue |
T |
Optional. Default is |
flags |
InjectFlags |
Optional. Default is |
Returns
T
: The instance from the injector if defined, otherwise the notFoundValue
.
Throws
Error
When the notFoundValue
is undefined
or Injector.THROW_IF_NOT_FOUND
.
abstract get(token: any, notFoundValue?: any): any
Deprecated from v4.0.0 use ProviderToken
Parameters
token |
any |
|
notFoundValue |
any |
Optional. Default is |
Returns
any
destroy()
|
---|
|
© 2010–2022 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/core/EnvironmentInjector