I have the following code, using the http client from Angular:
private fetch(): Observable<number> {
return this.http.get('myUrl')
.pipe(catchError((err) => of(0))),
);
}
fetchAll(): Observable<number> {
const fakeArray = [1,2];
return forkJoin(fakeArray.map(() => this.fetch()))
}
fetchAll
is then subscribed via | async
by a component
The purpose is to have a fallback to 0 whenever one of the call fails. However, it doesn’t work. I know that angular httpclient doesn’t complete when an error occurs. Is there any way I could work around that to achieve my fallback ?