With chaining a series of observables?

Asked

Viewed 70 times

0

I have to get the answer from a Observable and use it from parameter to another Observable, I’m using the operator switchMap() for that, but I don’t know if it’s the right way. Ex.:

Observable1.pipe(
switchMap(resposta1 => observable2(resposta1)),
switchMap(resposta2 => observable3(resposta2))
).subscribe(resposta3 => this.minhaVariavel = resposta3);
  • vc can use these "flatMap" operators such as mergeMapp, switchMap, exhaustMap, depending on your use case

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.