【发布时间】:2017-04-26 15:07:31
【问题描述】:
app.module.js
AppModule.annotations = [
new NgModule({
declarations: [
SomeComponent
],
providers: [
{provide: SOME_CONSTANT, useValue: 'whatever'}
]
})];
如何将 SOME_CONSTANT 注入 SomeComponent (some.component.js)?
SomeComponent.parameters = [
[SOME_CONSTANT]
];
不起作用。什么是显而易见的,因为解释器如何知道SOME_CONSTANT 是什么。
【问题讨论】:
标签: angular dependency-injection ecmascript-6