Destroying components using the destory() function

One can destroy components manually by using the component.destory() function. The following code shows an example of destroying a component with a specified ID:

var componentToDestory = component.find("newCmp");//newCmp is the aura:id of the component to destroy
componentToDestory.destroy();
After a component that is declared in the markup is no longer in use, the framework automatically destroys it and frees up its memory. If you create a component dynamically in JavaScript and that component isn't added to a facet (v.body, or another attribute of the type Aura.Component[]), you have to destroy it manually by using destroy(), to avoid memory leaks. 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.213.238