Angular – Observables vs Promise

angular

Deprecated: get_the_author_email is deprecated since version 2.8.0! Use get_the_author_meta('email') instead. in /home/cloudber/public_html/wp-includes/functions.php on line 4713

Observable is not part of Angular but RxJS. RxJS is installed together with Angular. Promise is part of ES2015.

Both Observable and Promise pretty much serve the same purpose, which is for asynchronous operation, such as return response from an asynchronous call.

# Observables Promise
1 Handle multiple events at a time Handles a single event at a time
2 Cancel-able & Retry-able Neither can be cancelled nor retried
3 Supports map, filter, reduce and similar operators

Example of using Promise

Example of using Observable

Author: Wu Chia Chong

My main areas of interest are software architectures and software design methods, patterns, and new trends in software development.

Author: Wu Chia Chong

My main areas of interest are software architectures and software design methods, patterns, and new trends in software development.