I have a component X that needs an outcome of subscription to multiple observables and than send this outcome to component Y. These are the observables that must be somehow united to produce the result that I need:
- getChosenCityId (behaviourSubject) // once I have id, I can get city like so:
- getCityById(id) (result of a http call)
// Once I have the city, which is an object, I need its property - cityLocation
- getCitiesByLocation(cityLocation) (result of a http call) // cityLocation from the previous line
- getNearbyCities. (behaviorSubject) Returns a boolean. If it is true, I need
a)
- citiesByLocation (4.)
- chosenCityId (1.)
and if it is false, I need:
b)
- city (2.)
- chosenCityId(1.)
a) and b) are the outcomes that I need to send to the component Y (with next). How can I chain all these observables?