D
D
Daniil Popov2021-08-03 09:34:10
Angular
Daniil Popov, 2021-08-03 09:34:10

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 @Inputand @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

1 answer(s)
A
Anton Shvets, 2021-08-03
@groog

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 question

Ask a Question

731 491 924 answers to any question