RxJS 6 examples in Angular 6 – Conditional Operators

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

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.