How does one cancel a subscription in Angular2? RxJS seems to have a dispose method, but I can\'t figure out how to access it. So I have code that has access to an EventEm
ngOnDestroy(){ mySubscription.unsubscribe(); }
Prefer unsubscribing rxjs unsubscribe's while destroying the component i.e., removing from DOM for avoiding unecessary memory leaks
Use
if(mySubscription){ mySubscription.unsubscribe(); }