Answer the question
In order to leave comments, you need to log in
How to create dynamic components?
By the will of fate, I have to dive into development in Angular . In general, everything is clear, except for the organization of work with dynamic components. Rendering the component via NgComponentOutlet is no problem. Problems arise when it is necessary to use @Input
and @Output
, i.e. when data exchange is required, i.e., in practice, always.
Please share your experience or good articles on the topic.
Ps Judging by the docks, data exchange is organized through Injector , but it looks somehow very tricky
Answer the question
In order to leave comments, you need to log in
If a single transmission is through the injector.
You can also communicate through services or by receiving componentInstance
.
If you need inputs directly in the template, then there are either like https://github.com/IndigoSoft/ngxd but as a rule you can do without them. Since everything is typed, and here we get a dynamic unpredictable input.
Better then make a wrapper with ngSwitch. A little slower, but clearer.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question