Differences between Promise and Observable in Angular

Code examples and video tutorials about Promise and Observable in Angular.js
05 September 2017   25938


Promise handles a single event when an async operation completes or fails.

Note: There are Promise libraries out there that support cancellation, but ES6 Promise doesn't so far.


An Observable is like a Stream (in many languages) and allows to pass zero or more events where the callback is called for each event.

Often Observable is preferred over Promise because it provides the features of Promise and more. With Observable it doesn't matter if you want to handle 0, 1, or multiple events. You can utilize the same API in each case.

Observable also has the advantage over Promise to be cancelable. If the result of an HTTP request to a server or some other expensive async operation isn't needed anymore, the Subscription of an Observable allows to cancel the subscription, while a Promise will eventually call the success or failed callback even when you don't need the notification or the result it provides anymore.

Observable provides operators like mapforEachreduce, ... similar to an array

There are also powerful operators like retry(), or replay().

WebStorm IDE to Get New Update

Version 2018.3 of one of the JetBrain's IDE has many new features and updates
22 November 2018   295

JetBrains has introduced an update to the WebStorm integrated development environment. In version 2018.3, support for TypeScript 3.1, JSON format, as well as the ability to pull Requests for GitHub are implemented.

The main innovations WebStorm 2018.3:

  • Automatic import of characters from project dependencies in JavaScript, parameters have hints. Improved null and undefined checks.
  • New function "Suggest variable names."
  • TypeScript 3.1 support.
  • An accessibility check for HTML added. Also, developers have improved the removal of actions for HTML and JSX tags — the user no longer needs to start reformatting the code or do it manually.
  • Data from CSS files can be transferred to other files.
  • WebStorm now warns about undefined components of React.
  • Added support for Vuetify in the framework Vue.js.
  • In Node.js, an experimental function of workflows has appeared - they can be used for tasks that heavily load CPUs.

The changes also affected the development environment itself. For example, support for interceptions and pull requests for GitHub. Users have access to a new contrast theme.

In March 2018, version 2018.1 was released. In it, the developers added support for the Prettier code formatting service, as well as compact pop-up notifications with documentation for all supported languages