inject
function
Injects a token from the currently active injector.
inject is only supported in an injection context. It
can be used during:
- Construction (via the
constructor) of a class being instantiated by the DI system, such as an@Injectableor@Component. - In the initializer for fields of such classes.
- In the factory function specified for
useFactoryof aProvideror an@Injectable. - In the
factoryfunction specified for anInjectionToken. - In a stackframe of a function call in a DI context
API
Usage Notes
Jump to details