Angular2 RC5 shared Component between Modules

后端 未结 3 1088
清歌不尽
清歌不尽 2020-12-17 17:23

I\'m just updating my angular2-app to new RC5. I got quite far, and everything seems ok, but now I want to re-organize it into NgModules

3条回答
  •  遥遥无期
    2020-12-17 18:05

    You have to make a module for the shared component and import this module where you want to use this component.

    As the error messages says a component (or directive, or pipe) can only be listed in directives of exactly one module.

    If you want to reuse, then you need to add the module that contains it to @NgModule({imports: [...]}) of the module where you want to use it.

提交回复
热议问题