RxJS - Join Operator merge



This operator will take in the input observable and will emit all the values from the observable and emit one single output observable.

Syntax

merge(observable:array[]): Observable

Parameters

observable − The input will be an array of Observable.

Return value

It will return an observable with a single value as output.

Example

import { of, merge } from 'rxjs';
import { concat } from 'rxjs/operators';

let list1 = of(2, 3, 4, 5, 6);
let list2 = of(4, 9, 16, 25, 36)
let final_val = merge(list1, list2);
final_val.subscribe(x => console.log(x));

Output

Merge Operator
Advertisements