https://angular.io/guide/rx-library
- A
promise
can be subcribed. - It will give an
observable
.
const secondsCounter = interval(1000);
secondsCounter.subscribe(n =>
console.log(`It's been ${n} seconds since subscribing!`));
- You can use multiple built-in
Operators
onobservable
- The
map()
method creates a new array with the results of calling a provided function on every element in the calling array. - The
filter()
method creates a new array with all elements that pass the test implemented by the provided function.
- The
- You can use pipes to link operators together.
const squareOdd = of(1, 2, 3, 4, 5)
.pipe(
filter(n => n % 2 !== 0),
map(n => n * n)
);
- RxJS provides the
catchError
operator that lets you handle known errors in the observable recipe.
- Creation from, fromPromise,fromEvent, of
- Combination combineLatest, concat, merge, startWith , withLatestFrom, zip
- Filtering debounceTime, distinctUntilChanged, filter, take, takeUntil
- Transformation bufferTime, concatMap, map, mergeMap, scan, switchMap
- Utility tap
- Multicasting share