Injector
Class
Concrete injectors implement this interface. Injectors are configured with providers that associate dependencies of various types with injection tokens.
API
Usage Notes
abstract class Injector {}
get
5 overloads
Retrieves an instance from the injector based on the provided token.
@paramnotFoundValue
undefined
@returns
T
Retrieves an instance from the injector based on the provided token.
@paramnotFoundValue
null | undefined
@returns
T | null
Retrieves an instance from the injector based on the provided token.
@paramnotFoundValue
T | undefined
@returns
T
Retrieves an instance from the injector based on the provided token.
@paramnotFoundValue
T | undefined
@returns
T
@paramtoken
any
@paramnotFoundValue
any
@returns
any
THROW_IF_NOT_FOUND
{}
NULL
create
2 overloads
Creates a new injector instance that provides one or more dependencies,
according to a given type or types of StaticProvider
.
@paramoptions
{ providers: (any[] | TypeProvider | ValueProvider | ClassProvider | ConstructorProvider | ExistingProvider | FactoryProvider | StaticClassProvider)[]; parent?: Injector | undefined; name?: string | undefined; }
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.
@returns
Injector
Jump to details