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], 
}) 
+0

PLATFORM_DIRECTIVES没有任何意义了呢? – Scipion

+0

看起来它甚至不在API文档中了https://angular.io/docs/js/latest/api/#!?apiFilter=_directives –