How does ngOnDestroy in Angular?

Understand what are the life cycles of the component and do not quite understand how it works ngOnDestroy .
In dock it is written : "This method is called just before framework deletes the component." But, what do you mean "remove component" obesnite please, what is meant.
June 5th 19 at 21:46
1 answer
June 5th 19 at 21:48
Solution
In other words, ngOnDestroy component occurs when the element is removed from the DOM (as a result of work ngIf, ngFor, ngSwitch, when you change routes, etc.)

Example: https://stackblitz.com/edit/angular-dsakut?file=sr...

Find more questions by tags AngularJavaScript