- RxJS Tutorial
- RxJS - Home
- RxJS - Overview
- RxJS - Environment Setup
- RxJS - Latest Updates
- RxJS - Observables
- RxJS - Operators
- RxJS - Working with Subscription
- RxJS - Working with Subjects
- RxJS - Working with Scheduler
- RxJS - Working with RxJS & Angular
- RxJS - Working with RxJS & ReactJS
- RxJS Useful Resources
- RxJS - Quick Guide
- RxJS - Useful Resources
- RxJS - Discussion
RxJS - Transformation Operator mergeMap
In the case of mergeMap operator a project function is applied on each source value and the output of it is merged with the output Observable.
Syntax
mergeMap(project_func: function): Observable
Parameters
project_func − It takes in project_func as the argument which is applied to all the values of source observable.
Return value
It returns an Observable that has values based on the project_func applied on each value of source observable.
Example
import { of} from 'rxjs'; import { mergeMap, map } from 'rxjs/operators'; let text = of('Welcome To'); let case1 = text.pipe(mergeMap((value) => of(value + ' Tutorialspoint!'))); case1.subscribe((value) => {console.log(value);});
Output
Advertisements