Imagine situation in which you want to execute http call only when previous call has finished and returned results that the second http call depends on. For instance you want to send email to the customer only when his data has been updated in the system. One endpoint (microservice) is responsible for customer update, second for sending email. This is quite common architecture nowadays where monolith app has been stripped into lots of microservices.
In angular this is easily achievable with Observable and flat map and it came from rxjs library.
Fully working demo is available in this stackblitz example :
https://abdeveloper-observables-chain.stackblitz.io
Main app component
Service
And as you can see in network activity 2 call has been executed after 1st call finished.
In angular this is easily achievable with Observable and flat map and it came from rxjs library.
Fully working demo is available in this stackblitz example :
https://abdeveloper-observables-chain.stackblitz.io
Main app component
Service
And as you can see in network activity 2 call has been executed after 1st call finished.
This was much needed and I was looking for it more than a month now. Thanks for the useful info. Keep up the good work!
ReplyDeleteYour blog got me to learn a lot,thanks for shearing.
ReplyDeleteExcellent Content. I enjoy how you present. Continue to impart more information.
ReplyDeleteThanks for Sharing an Amazing Blog Post!
ReplyDeleteFantastic code shows here...
ReplyDeleteownership drive whatever you want.
ReplyDeletethere no recognition.
ReplyDeletethis is amazing.
ReplyDeleteout of the box work.
ReplyDeleteHe need same things.
ReplyDeletevery high status.
ReplyDeletethis know of all.
ReplyDelete¡Gran artículo! Me ayudó a entender mejor cómo encadenar llamadas HTTP en Angular. Además, si alguien necesita descargar algún apktodo apk mod para probar, recomiendo usar una fuente confiable. ¡Saludos!
ReplyDelete