Here is just regular request looking like that:
this.people = http.get('http://localhost:3000/users')
.map(response => response.json());
}
Is there any way to dealy/timeout that?
Here is just regular request looking like that:
this.people = http.get('http://localhost:3000/users')
.map(response => response.json());
}
Is there any way to dealy/timeout that?
The return value of
http.get()
is an observable, not the response. You can use it like:See also https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/timeout.md
If you are using RxJS version 6 and above the current syntax is this:
import { timeout } from 'rxjs/operators';
You can leverage the
timeout
operator of observables, as described below:See this article for more details (with the section "Retry support"):