The dynamic component of Angular?

If a dynamic kit has been created, for example by clicking, does this mean that Angular when re-clicked, it will not be re-created, and return existing in the state in which it was at last time use?

Weighs whether in tamo case, the project less? Or is it only in the pending display of the set, the allocation under it is memory? What's the different from ngif?

Tell me how to create a sheet with dynamic components and to manage them? Hide, show, destroy, or receive data from one?

Thank you!
April 7th 20 at 15:17
1 answer
April 7th 20 at 15:19

If a dynamic kit has been created, for example by clicking, does this mean that Angular when re-clicked, it will not be re-created, and return existing in the state in which it was at last time use?

Destroy of course, there will he forever keep it. Save the component in the parent, or those "dynamic" components generated by the router, using the strategy of reusing.

Weighs whether in tamo case, the project less?

No. The weight of the project code descriptions of your templates and classes. Read on classes and constructor functions in js.

What's the different from ngif?

The dynamic component you can create not showing him, to give him any context and the injector. You cannot pass input parameters (well, by default it is impossible, in General, you can directly initialize a field, or use libraries).

Tell me how to create a sheet with dynamic components and to manage them? Hide, show, destroy, or receive data from one?

https://angular.io/guide/dynamic-component-loader
It is not necessary to obtain component of any data. Exactly the opposite, the component must retrieve data for display from any of their sources (ie from the injector).
Thank you for your answer, how then to be, when you need to switch the components in the workspace. And keep their last state? - ardith commented on April 7th 20 at 15:22
@Alek.Mayer, I have already written, if you want to save some state, then it is not the task of the component.
Task component - status to show.
Services - very flexible and powerful tool. - Robbie.Feest commented on April 7th 20 at 15:25

Find more questions by tags Angular