A memory leak occurs when a section of memory that is no longer being used is still being occupied needlessly instead of being returned to the OS
In Angular components or directives, you will unsubscribe inside the
ngOnDestroy lifecycle hook.
For example, if you have a component with three subscriptions:
You need to create the
ngOnDestroy method and unsubscribe from each.
OK, that’s nice, but I want to
... read the whole story at netbasal.com.