I'm using RxJS in an Angular project and I have a Subscription to an Observable that emits values at a regular interval.
In the same component, I'm also using RxJS (combined with the Angular http client) to make a web call and subscribe to it.
What I want to do is simple: when I make my web call and it has returned a result, I want to wait until the Subscription receives the next value before processing the result. Let's see it better with a code sample:
Suppose I have this Subscription that receives new values from an Observable at regular intervals:
tenantStatusSub: Subscription; Here's what I want to do, explained in the comment:
this.httpClient.get<any>(...).subscribe({ next: result => { /* I want to wait here for tenantStatusSub to receive a value before proceeding */ }, error: err => { //... } }); I'm sure there is a straightforward way to do this, but I'm still learning RxJS so I'm not sure what the best/cleanest way is.