defineInjectablelink
Construct an InjectableDef which defines how a token will be constructed by the DI system, and in which injectors (if any) it will be available.
参数
| opts | Type: |
返回值
never
说明
This should be assigned to a static ngInjectableDef field on a type, which will then be an InjectableType.
Options:
providedIndetermines which injectors will include the injectable, by either associating it with an@NgModuleor otherInjectorType, or by specifying that this injectable should be provided in the'root'injector, which will be the application-level injector in most apps.factorygives the zero argument function which will create an instance of the injectable. The factory can callinjectto access theInjectorand request injection of dependencies.