Reputation: 45
i have to make 2 http requests, the second one depends on the first one's result. How to make it possible ? I tried subscribe and map, but not working. Thank you for yor time
Upvotes: 0
Views: 34
Reputation: 29305
hard to show you without your own code but it would look something like this:
this.request1().pipe(
switchMap(result1 => this.request2(result1.neededProp))
).subscribe(result2 => console.log(result2))
switchmap takes the value from 1 observable response and switches into another observable.
Upvotes: 2