我的Angular2 RC6应用程序有两个模块,我不知道如何声明共享组件.
我有一个名为spinnerComponent的组件,它在整个应用程序中使用.我在app.modules.as中定义了它:
@NgModule({ imports: [BrowserModule,routing,RepairReturnModule],providers: [ ],declarations: [AppComponent,SpinnerComponent],bootstrap: [AppComponent] })
然后在RepairreturnModule中我再次定义它:
@NgModule({ imports: [CommonModule],declarations: [ SpinnerComponent ],providers: [] })
正如所料,我得到:
Type SpinnerComponent is part of the declarations of 2 modules:
RepairReturnModule and AppModule
我从RepairreturnModule中的声明中删除了SpinnerComponent,然后我得到:
Unhandled Promise rejection: Template parse errors: Can’t bind to
‘isRunning’ since it isn’t a known property of ‘spinner-component’.
1. If ‘spinner-component’ is an Angular component and it has ‘isRunning’ input,then verify that it is part of this module.
2. If ‘spinner-component’ is a Web Component then add “CUSTOM_ELEMENTS_SCHEMA” to the ‘@NgModule.schema’ of this component
to suppress this message. … which indicated that it is not declared.
我错过了什么?