Mastering Subscription Handling in Angular
The lack of subscription handling can cause many problems in your app, the most critical one is memory leak. Subscriptions are not bundled with the component; therefore, we also need to dispose of subscriptions when the components are being destroyed. To destroy the subscription we created we can use the method on the function we created.