0

How can I do multiple http requests, so for this scenario how can I do another request budgetService.getData() after the getBudgetDays() requests completes?

this.budgetService.getBudgetDays(this.startDate, this.finishDate).pipe(
  catchError(res => this.budgetTestService.getBudgetDates(this.startDate, this.finishDate)),
).subscribe(res => {
  // res = value of getBudgetDays if no error, or getBudgetDates if there is one
});
matt
  • 659
  • 2
  • 8
  • 15
  • This should be already answered in any of the links above. If it doesn't let me know and I'll reopen question. – martin Feb 18 '19 at 11:32
  • some answers use switchMap, concatMap, mergeMap. Which one should I use? – matt Feb 18 '19 at 11:35
  • It depends on what you want to do. Probably `concatMap` or `mergeMap` I guess. – martin Feb 18 '19 at 11:38
  • Also have a look here https://stackoverflow.com/questions/53153902/angular-interval-pipe-with-a-longer-task-inside/53154900#53154900 for what's the difference – martin Feb 18 '19 at 12:01

0 Answers0