How to cancel/abort all pending HTTP requests in angular 4+.
There is an unsubscribe method to cancel HTTP Requests but how to cancel all pending requests all at once.
Especially while route change.
There is one thing I did
ngOnDestroy() {
this.subscription.unsubscribe();
}
but how to achieve this globally
Any Ideas?
ngOnDestroycallback is typically used for any custom cleanup that needs to occur when the instance is destroyed.where do you want to cancel your request?
maybe if you want cancel your requests on browser close there is creative idea here