不同模块中指令或组件的声明,angular 4

Declaration of directive or component in defferent modules, angular 4

是否可以为多个模块声明一个directive/component? 我只能导出一个:

import { Directive, ElementRef } from '@angular/core';

@Directive({ selector: '[appBigText]' })
export class BigTextDirective {
  constructor(el: ElementRef) {
    el.nativeElement.style.fontSize = '100px'
  }
}


module one:

import { BigTextDirective }   from '../common/directives/dir225';
@NgModule({
  imports: [HttpModule...........
  
  providers :[homeService],
  declarations: [
    HomeComponent,
    DetailComponent,
    BigTextDirective
  ]

component:
import { BigTextDirective }   from '../common/directives/dir225';

@Component({
  selector: 'my-app',
  template: `
<router-outlet></router-outlet>
  <div appBigText>This text is huge.</div>.
  `
})

module two is same inculding, but i have error 
错误: 类型 BigTextDirective 是 2 个模块声明的一部分:HomeModule 和 NotesModule!请考虑将 BigTextDirective 移动到导入 HomeModule 和 NotesModule 的更高模块。您还可以创建一个导出并包含 BigTextDirective 的新 NgModule,然后在 HomeModule 和 NotesModule 中导入该 NgModule。

如果您需要在多个模块中使用相同的 component/directive,这意味着它是通用的。那为什么不按照错误提示提取BigTextDirective分离模块导出呢?

NgModule({
  // ...
  providers: [
    BigTextTexture
  ]
  exports: [
    BigTextTexture
  ]
})
export class CommonModule {}

因此您只需导入它就可以轻松地在高级模块中重复使用它:

@NgModule({
  imports: [
    CommonModule
  ],
  declaration: [
    INeedBigTextTextureComponent
  ]
})
export class HighLevelModule {}

让Angular帮助您组织代码!