Search⌘ K

The RxJS Library

Explore the RxJS library in Angular to create and manipulate observables using operators like fromEvent, of, from, tap, map, and filter. Learn how to build reactive components that respond dynamically to user inputs and events, enhancing your app's responsiveness and maintainability.

In this lesson, we will learn about the RxJS library, which provides the observable operators, and learn about some of them through examples.

As mentioned previously, Angular comes with a peer dependency on RxJS, the JavaScript flavor of the ReactiveX library that allows us to create observables out of a large variety of scenarios, including the following:

  • Interaction events

  • Promises

  • Callback functions

  • Events

In this sense, reactive programming does not aim to replace asynchronous patterns, such as promises or callbacks. It can leverage them as well to create observable sequences.

RxJS has built-in support for a wide range of composable operators to transform, filter, and combine the resulting event streams. Its API provides convenient methods for observers to subscribe to these streams so that our components can respond accordingly to state changes or input interaction. Let’s see some of these operators in action in the following sections.

Creating observables

We have already learned ...