Readonly
parentReadonly
scopeReadonly
sourceRetrieves an instance from the injector based on the provided token.
When the notFoundValue
is undefined
or Injector.THROW_IF_NOT_FOUND
.
Optional
notFoundValue: TOptional
flags: InjectFlagsThe instance from the injector if defined, otherwise the notFoundValue
.
Optional
notFoundValue: anyGenerated using TypeDoc
Concrete injectors implement this interface. Injectors are configured with providers that associate dependencies of various types with injection tokens.
See
StaticProvider
Usage Notes
The following example creates a service injector instance.
{@example core/di/ts/provider_spec.ts region='ConstructorProvider'}
Usage example
{@example core/di/ts/injector_spec.ts region='Injector'}
Injector
returns itself when givenInjector
as a token:{@example core/di/ts/injector_spec.ts region='injectInjector'}
Public Api