I want to provide feedback to the user if a timeout event occurs in an HTTP call.
I tried this:
return this._http
.post(apiUrl + 'Search/Everything', params, {withCredentials: true, headers: this.headers})
.timeout(5000, this._feedbackService.error("Custom error message"))
.map((response: Response) => response.json().data);
But this calls the feedback service as soon as the HTTP call is made.
How do I start a service when a timeout is triggered?
source
share