How to catch error in Observable.forkJoin(…)?
问题 I use Observable.forkJoin() to handle the response after both http calls finishes, but if either one of them returns an error, how can I catch that error? Observable.forkJoin( this.http.post<any[]>(URL, jsonBody1, postJson) .map((res) => res), this.http.post<any[]>(URL, jsonBody2, postJson) .map((res) => res) ) .subscribe(res => this.handleResponse(res)) 回答1: You may catch the error in each of your observables that are being passed to forkJoin : // Imports that support chaining of operators