- 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 expand
The expand operator takes in a function as an argument which is applied on the source observable recursively and also on the output observable. The final value is an observable.
Syntax
expand(recursive_func:observable): Observable
Parameters
recursive_func − A function is applied to all the values coming from the source and returns an Observable.
Return value
An observable, with values as per the result of the recursive_func.
Example
import { of } from 'rxjs'; import { expand } from 'rxjs/operators'; let buffered_array = of(2).pipe(expand(x => of(2 * x))); buffered_array.subscribe(arr => console.log(arr));
Output
Advertisements
To Continue Learning Please Login
Login with Google