Promise vs. Observables with AJAX
Let's see the behavior of Promises and Observables with AJAX, and some useful constructors and operators like fromPromise, toPromise, retry, etc.
AJAX requests
A question that always comes up when discussing using observables to make AJAX requests is: “Why not promises?” As we learned in Creating Observables, a promise represents a
An AJAX request is a single value.
Promises vs. observables
Promises are simpler in concept, but the real world always complicates things. Pretend you’re developing the mobile platform for a ridesharing app. Users will typically use the app outside, away from solid Wi-Fi.
They’re trying to get somewhere, so they have a low tolerance for latency and errors. With that in mind, we’ll use the following code to build the best user experience for updating the user on the status of their ride:
Get hands-on with 1400+ tech skills courses.