Abstract
Static
NULLStatic
THROW_Static
Internal
__NG_Abstract
getRetrieves 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
.
Static
createCreates a new injector instance that provides one or more dependencies,
according to a given type or types of StaticProvider
.
An object with the following properties:
providers
: An array of providers of the StaticProvider type.parent
: (optional) A parent injector.name
: (optional) A developer-defined identifying name for the new injector.Optional
name?: stringOptional
parent?: InjectorThe new injector instance.
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