i looked for answers here but found none so i will go ahead and try to explain my situation as clearly as i can in hope that i get one.
Here is the situation : I am building an angular 4 SPA that consumes a rest API backend.
In one of my component i have to fetch several sets of data from the backend (from different methods), and i need to have all these different sets of data to display a chart in my component.
If i just make consecutive http calls in my Init method and then call my process_data method, angular does not wait for all http responses before it calls the processing method. Thus the method is called when all needed data is not necessarily there yet, which can cause errors.
The solution i have right now : The fix i implemented for the time being is the following :
I believe you will find what you are looking for in Flatmaps or the other solutions found in this great tutorial.
Flatmaps will help you make your multiple HTTP requests linear.
To quote the official documentation:
transform the items emitted by an Observable into Observables, then flatten the emissions from those into a single Observable