Concatmap is sequential do not subscribe another if another is in progress.
Mergemap is parallel, subscribe all inner observable at home nce and enit values as soon as one comlete.
Example :
const series2$ = of('x', 'y');
const result$ = concat(series1$, series2$);
result$.subscribe(console.log);
Output : a ,b, x, y
Example Merge
const series1$ = interval(1000).pipe(map(val => val*10));
const series2$ = interval(1000).pipe(map(val => val*100));
const result$ = merge(series1$, series2$);
result$.subscribe(console.log);
Output
0
0
10
100
20
200
30
300
No comments:
Post a Comment