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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.