RxJS - Join Operator concat



This operator will sequentially emit the Observable given as input and proceed to the next one.

Syntax

concat(observables: Array): Observable

Parameters

observables − The input given is an array of Observables.

Return value

An observable is returned with a single value merged from the values of the source observable.

Example

import { of } 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 = list1.pipe(concat(list2));
final_val.subscribe(x => console.log(x));

Output

We have concat two observables into one. Below is the output.

concat Operator
Advertisements