I'm currently reading about observables and promises. From what I understand promise only returns a single value whereas observable can return a stream of values. I understand the concept of of observables in simple cases like following
const myObservable = of(1, 2, 3);
// Create observer object
const myObserver = {
next: x => console.log('Observer got a next value: ' + x),
error: err => console.error('Observer got an error: ' + err),
complete: () => console.log('Observer got a complete notification'),
};
but why use observables in angular http calls? Since server responds to http calls only once ,it returns a single value not a stream of values right?Then what is the advantage of using observables over promises in http calls?