memory leaks so we are removing the event handler using the ngOnDestroy hook
Angular 2 — Escape From Change Detection
Netanel Basal
1209

Do we actually need to do this? ngOnDestroy will run when the element is destroyed — and when the element is being destroyed, the listeners are also removed automatically.

Like what you read? Give Tomek Sułkowski a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.