简体   繁体   English

无法从 angular 8 中的不同模块访问组件?

[英]Unable to access component from different module in angular 8?

I am trying to access my component which is defined in separate module in angular app in my app.module.我正在尝试访问我的组件,该组件在我的 app.module 中的 angular 应用程序的单独模块中定义。 I have exported the component as well and imported the module in my app module as defined below:我也导出了组件并将模块导入到我的应用程序模块中,如下定义:

@NgModule({
  declarations: [TabsComponent, SelectProviderComponent, HeaderComponent, FooterComponent],
  imports: [
    CommonModule
  ],
  exports: [TabsComponent, SelectProviderComponent, HeaderComponent, FooterComponent],
})

It still throwing me an error that component is not defined.它仍然给我一个未定义组件的错误。 Any leads?有什么线索吗?

I have found the answer - Thanks to @Nayak in above comment.我找到了答案 - 感谢上面评论中的@Nayak。 I restarted the server, build the app again and it worked like a charm.我重新启动服务器,再次构建应用程序,它就像一个魅力。

Thanks!谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM