0

I am working on an Angular app that needs to display a specific on command. Instead of having all 1 30 the components on the DOM and using ngIf to hide and show them, I've decided to load them dynamically using resolveComponentFactory. The problem is, resolveComponentFactory takes in a component object.

I know which component I need to load (when needed), I have it's name/ID. Is there way to retrieve the component object from the AppModule? All the components (+/- 130) I could potentially load are listed under the declarations section. Or is there another way to get a component if you have its name/ID?

  • 1
    Think [this](https://stackoverflow.com/questions/40115072/how-to-load-component-dynamically-using-component-name-in-angular2) thread may detail how to do what you're looking for – Jonathan Mar 29 '22 at 14:38

0 Answers0