EnvironmentInjector • Angular
Retrieves an instance from the injector based on the provided token.
@paramnotFoundValueundefined
@returnsT
The instance from the injector if defined, otherwise the notFoundValue.
Retrieves an instance from the injector based on the provided token.
@paramnotFoundValuenull | undefined
@returnsT | null
The instance from the injector if defined, otherwise the notFoundValue.
Retrieves an instance from the injector based on the provided token.
@paramnotFoundValueT | undefined
@returnsT
The instance from the injector if defined, otherwise the notFoundValue.
@deprecated
from v4.0.0 use ProviderToken
@returnsany
Runs the given function in the context of this EnvironmentInjector.
Within the function's stack frame, inject can be used to inject
dependencies from this injector. Note that inject is only usable synchronously, and cannot be
used in any asynchronous callbacks or after any await points.
@paramfn() => ReturnT
the closure to be run in the context of this injector
@returnsReturnT
the return value of the function, if any
Indicates whether the instance has already been destroyed.