Friday, 19 August 2022

Angular - how to use entrycomp of a comp from another module

 

How to use component from module in entryComponents another module?


https://stackoverflow.com/questions/55305259/how-to-use-component-from-module-in-entrycomponents-another-module



You should be declaring the FirstModalComponent in only one module. It can be part of one module and exported by the same and can be defined as entryComponent for it's own module.

For your case, declare it as

entryComponents: [ FirstModalComponent ]

for the FirstModalModule and export the FirstModalComponent from FirstModalModule. It will work as expected when you import FirstModalModule inside ModalsModule or any other module in your application.

Make sure this FirstModalModule is exported by your ModalsModule and the SharedModule depending on your use. if you want to use it by importing SharedModule into your DashboardModule, this has to be exported from SharedModule.

No comments:

Post a Comment