I'm currently developing an ionic 5 app and I've 2 observables, they returns 2 arrays of different object types. I want to mix some properties of the objects in a single one in a new type of object, but I only want to make the second call to the server if the first one returns values.
Example:
obs1$: Observable<{id: string, name: string, active: boolean}[]>;
obs2$: Observable<{id: string, location: Location, year: date}[]>;
newObs$: Observable<{id: string, name: string, year: date}[]>;
I want:
- Call
obs1$ - If
obs1$returns values then callobs2$, else returns[] - When
obs2$returns values, return an array of objects mapping results of both observables