Some more RxJS 6 examples in Angular 6. Each example follows the new Angular 6 RxJS 6 coding styles so they are tree-shakable and future-proof.
defaultIfEmpty – How to check if nothing is emitted before completion
If the source Observable turns out to be empty, then this operator will emit a default value. e.g. defaultIfEmpty(‘defaultIfEmpty triggered’).
Try out the example on StackBlitz.
every- How to check if all values pass a predicate
e.g. every(x => x < 10).
Try out the example on StackBlitz.
Other articles in this series
- RxJS 6 examples in Angular 6 – Creating observables
- RxJS 6 examples in Angular 6 – Transformation Operators
- RxJS 6 examples in Angular 6 – Filtering Operators
- RxJS 6 examples in Angular 6 – Conditional Operators
- RxJS 6 examples in Angular 6 – Error Handling Operators
- RxJS 6 examples in Angular 6 – Unsubscribe from Observables