- 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 - Filtering Operator ignoreElements
This operator will ignore all the values from the source Observable and only execute calls to complete or error callback functions.
Syntax
ignoreElements()
Return value
It returns an observable that will call complete or error based on the source observable.
Example
import { of } from 'rxjs'; import { ignoreElements } from 'rxjs/operators'; let all_nums = of(1, 6, 5, 10, 9, 20, 40); let final_val = all_nums.pipe(ignoreElements()); final_val.subscribe( x => console.log("The last value is = "+x), e => console.log('error:', e), () => console.log('The task is complete') );
ignoreElements() operator will directly execute the complete method if success and error if failure and ignore everything else.
Output
Advertisements
To Continue Learning Please Login
Login with Google