rc.5中的Angular2 PLATFORM_DIRECTIVES
我刚从rc.4迁移到rc.5。但是,我为整个应用定义的自定义指令不再被识别。rc.5中的Angular2 PLATFORM_DIRECTIVES
我曾经在我的app.component:
bootstrap(AppComponent, [ provide(PLATFORM_DIRECTIVES, {useValue: [CustomDirective1, CustomDirective2], multi: true})
])
现在用NgModule我有:
@NgModule({ declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: [
provide(PLATFORM_DIRECTIVES, {useValue: [CustomDirective1, CustomDirective2], multi: true})
],
bootstrap: [AppComponent],
})
CustomDirective1和CustomDirective2没有在我的应用程序了,虽然认可。还有什么我应该做的?
回答:
Directives should go in a module's declarations:
@NgModule({ declarations: [
AppComponent,
CustomDirective1,
CustomDirective2
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent],
})
以上是 rc.5中的Angular2 PLATFORM_DIRECTIVES 的全部内容, 来源链接: utcz.com/qa/265992.html