Back
I am new to rxjs operators
What is the most efficient way to execute two requests and check if one of the requests comes back as valid and also check if both failed.
I tried forkJoin but unable to determine how to when both requests failed.
There is not true, you can use forkjoin in this way:
this.forkJoinRequest= forkJoin([this.service.getMethod1(), this.service.getMethod2()]).subscribe(response => { this.list1= response[0]; this.list2=response[1]; }, (error) => { this.error_code = error.status; });
this.forkJoinRequest= forkJoin([this.service.getMethod1(), this.service.getMethod2()]).subscribe(response => {
this.list1= response[0];
this.list2=response[1];
},
(error) => { this.error_code = error.status; });
you can use your "error" to show why the forkjoin is failed.
Enroll in our Angular Certification to become an expert in angular!
31k questions
32.8k answers
501 comments
693 users