The pipe and map Functions
Learn how to use the pipe and map functions of the RxJS library to modify and combine Observables.
We'll cover the following...
We'll cover the following...
Overview of the pipe and map functions
The RxJS library provides a pipe function to all Observables, similar to the subscribe function. This pipe function takes a variable number of functions as parameters and will execute these functions on each value that is emitted by the Observable.
The functions that are provided to the pipe function are generally known as Observable operators, which all accept an Observable as input, and return an Observable as output. The pipe function emits an Observable stream.
This concept is best explained by reading some code, as in the following example:
-
We start with an Observable named
emitteron line 5, which will emit the values1through4. ...