FrontendDeveloper.in

Angular question detail

What is the difference between promise and observable?

Below are the list of differences between promise and observable:

ObservablePromise
Declarative: Computation does not start until subscription, so they can run whenever you need the resultExecutes immediately on creation
Provides multiple values over timeProvides only one
Subscribe method is used for error handling that facilitates centralized and predictable error handlingPush errors to the child promises
Provides chaining and subscription to handle complex applicationsUses only .then() clause
Back to all Angular questions
Get LinkedIn Premium at Rs 399