Concrete injectors implement this interface. Injectors are configured with providers that associate dependencies of various types with injection tokens.
StaticProvider
The following example creates a service injector instance.
{@example core/di/ts/provider_spec.ts region='ConstructorProvider'}
{@example core/di/ts/injector_spec.ts region='Injector'}
Injector returns itself when given Injector as a token:
Injector
{@example core/di/ts/injector_spec.ts region='injectInjector'}
Retrieves an instance from the injector based on the provided token.
When the notFoundValue is undefined or Injector.THROW_IF_NOT_FOUND.
notFoundValue
undefined
Injector.THROW_IF_NOT_FOUND
The instance from the injector if defined, otherwise the notFoundValue.
Generated 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