January 2019
Beginner
210 pages
4h 47m
English
The merge operator function can be used to merge the values of two observables into value pairs:
import { from } from "rxjs";import { merge } from "rxjs/operators";const observableA = from<number>([20, 40, 60, 80, 100]);const observableB = from<number>([1, 1]);const observableC = observableA.pipe(merge<number, number>(observableB));const subscription = observableC.subscribe( (value) => console.log(value));subscription.unsubscribe();
The preceding code snippet uses the merge operator to combine the values of two observables into a new observable. The values are ordered chronologically. The following marble diagram showcases the initial sequences and the result sequence after applying the merge operator:
The result sequence contains ...
Read now
Unlock full access