Observables are part of the RxJS library which Angular 10, and previous versions, uses for handling asynchronous operations like http requests.

In this article, we’ll learn:

  • what an observable is,
  • observables vs. promises,
  • how to convert an observable to a promise,
  • how to subscribe, unsubscribe and resolve observables directly in Angular templates,
  • how to use the pipe method of an observable with map and filter examples.

Note: While in this article, we focus on observables in the context of Angular 10 and its previous versions, it can actually be used with any JavaScript/TypeScript library or framework or even with no frameworks at all.

Observables are implemented in the RxJS library and you can simply import the library to start working with observables in your TypeScript code.

For Angular 10 and previous versions, RxJS is imported by default.

#angular

Angular 10 Observables With Pipe and Promise by Example
1.90 GEEK