This is the scenario (check this Stackblitz):
- I have two modules:
AppModuleandOtherModule. - In
AppComponent(from AppModule), I create two dynamic components, usingFirstComponentandSecondComponent. - In the
FirstComponenttemplate I insertHelloComponent, that belongs to the same module (AppModule), and it works fine. - The problem comes in the
SecondComponent, where I insertThirdComponent, that belongs toOtherModule. I receive the error: 'third' is not a known element. OtherModuleis imported inAppModule.- If I remove
<third></third>fromsecond.component.htmlthe app will run, but I need to insertThirdComponentinsideSecondComponent, and SecondComponent is dynamic.
So, how can I use inside a dynamic component a component from a different module?
Angular CLI: 12.0.1