In case you are wondering how to cancel a pending HTTP request, here is the (simple) answer. You can do this by calling unsubscribe on the Subscription object returned by the subscribe method.
An example:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let subscription = this.http.get(url) | |
.map(res => res.json()) | |
.subscribe(data => this.data = data); | |
// this call will cancel the http request | |
subscription.unsubscribe(); |