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.
map = how to transform values
The “map” operator transforms one value to another. e.g. map(x => x * 10).
Try out the example on StackBlitz.
reduce – How to aggrevate values e.g. 1 + 2 + 3 = 6
The “reduce” operator aggregates the values emitted by an observable. e.g. reduce((acc, curr) => acc + curr, 0).
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