Learn RxJS
Search…
skipWhile

signature: skipWhile(predicate: Function): Observable

Skip emitted values from source until provided expression is false.

Examples

Example 1: Skip while values below threshold
1
// RxJS v6+
2
import { interval } from 'rxjs';
3
import { skipWhile } from 'rxjs/operators';
4
5
//emit every 1s
6
const source = interval(1000);
7
//skip emitted values from source while value is less than 5
8
const example = source.pipe(skipWhile(val => val < 5));
9
//output: 5...6...7...8........
10
const subscribe = example.subscribe(val => console.log(val));
Copied!

Additional Resources

Last modified 2yr ago