Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (19.9k points)

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.

1 Answer

0 votes
by (25.1k points)
edited by

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; });

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

Browse Categories

...