January 2019
Beginner
210 pages
4h 47m
English
The find operator function can be used to find the first value in an observable that adheres to a given constraint:
import { from } from "rxjs";import { find } from "rxjs/operators";const observable = from<number>([2, 30, 22, 5, 60, 1]);observable.pipe(find(x => x > 10));const subscription = observable.subscribe( (value) => console.log(value));subscription.unsubscribe();
The preceding code snippet uses the find operator to find the first value in an observable greater than ten. The following marble diagram showcases the initial sequence and the result sequence after applying the find operator:

The result sequence contains only one value ...
Read now
Unlock full access