The difference between problem and observables

There is a discussion on stackoverflow: what is the difference between problems and observables?

A useful blog: angular2 observables, HTTP, and separating services and components

An article on the official website of angular: observables compared to other technologies

The difference between observable and promise:

Observables are declarative; computation does not start until subscription. Promises execute immediately on creation. This makes observables useful for defining recipes that can be run whenever you need the result.

Observable is declarative, and calculation is not triggered until subscription. This is very different from promise — promise is executed immediately after it is created.

Observables provide many values. Promises provide one. This makes observables useful for getting multiple values over time.

Observable provides multiple values, while promises can only provide a single value.

Observables differentiate between chaining and subscription. Promises only have .then() clauses. This makes observables useful for creating complex transformation recipes to be used by other part of the system, without causing the work to be executed.

Observable can be combined into complex transformation recipes with the help of rich operators in rxjs, which is convenient for reuse in application, while promise has only one then operation.

Observables subscribe() is responsible for handling errors. Promises push errors to the child promises. This makes observables useful for centralized and predictable error handling.

Read More: