I have a screen with a left side list having different links and right side showing details of each. I am using below service to get the details.
getDetails(id: string) : Observable<any>{
const url = `${environment.server}/api/details/${id}`
return Observable.of(1)
.debounceTime(2000)
.switchMap(() => this.http.get(url))
.map(r => r.json())
}
- Is it a good approach to use
Observable.of(1)
where1
has no significance? Is there a different approach? - Is this how we prevent multiple clicks/request for details and reply only to the latest one?
- In this case how do I catch the errors in
http
?