defineInjector
function
Construct an InjectorDef
which configures an injector.
defineInjector(options: { factory: () => any; providers?: any[]; imports?: any[]; }): never
Parameters
options | object |
Returns
never
Description
This should be assigned to a static ngInjectorDef
field on a type, which will then be an InjectorType
.
Options:
-
factory
: anInjectorType
is an instantiable type, so a zero argumentfactory
function to create the type must be provided. If that factory function needs to inject arguments, it can use theinject
function. -
providers
: an optional array of providers to add to the injector. Each provider must either have a factory or point to a type which has anngInjectableDef
static property (the type must be anInjectableType
). -
imports
: an optional array of imports of otherInjectorType
s orInjectorTypeWithModule
s whose providers will also be added to the injector. Locally provided types will override providers from imports.
© 2010–2019 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v7.angular.io/api/core/defineInjector