rxjs里switchMap operators的用法

简介: rxjs里switchMap operators的用法

switchMap相关文章

rxjs里switchMap operators的用法

通过rxjs的一个例子, 来学习SwitchMap的使用方法

rxjs switchMap的实现原理

rxjs的map和switchMap在SAP Spartacus中的应用 -将高阶Observable进行flatten操作

Projects each source value to an Observable which is merged in the output Observable, emitting values only from the most recently projected Observable.


理解记忆法:switchMap -> switch to a new Observable,亦即SwitchMap返回的OperatorFunction,其function的输出是一个新的Observable.


例子:


const switched = of(1, 2, 3).pipe(switchMap((x: number) => of(x, x ** 2, x ** 3)));

   switched.subscribe(x => console.log(x));

image.pngimage.pngimage.png

目录
相关文章
|
缓存 JavaScript 前端开发
RxJS系列05:操作符 Operators(下)
RxJS系列05:操作符 Operators(下)
|
10月前
|
API
Rxjs map, mergeMap 和 switchMap 的区别和联系
Rxjs map, mergeMap 和 switchMap 的区别和联系
|
JavaScript 前端开发 Go
RxJS系列04:操作符 Operators(上)
RxJS系列04:操作符 Operators(上)
rxjs里mapTo operators的用法
rxjs里mapTo operators的用法
125 0
rxjs里mapTo operators的用法
rxjs里withLatestFrom operators的用法
rxjs里withLatestFrom operators的用法
100 0
rxjs里withLatestFrom operators的用法
|
JavaScript
rxjs里distinctUntilChanged operators的用法
rxjs里distinctUntilChanged operators的用法
104 0
rxjs里distinctUntilChanged operators的用法
rxjs里debounceTime operators的用法
rxjs里debounceTime operators的用法
100 0
rxjs里debounceTime operators的用法
rxjs里takeWhile operators的用法
rxjs里takeWhile operators的用法
100 0
rxjs里takeWhile operators的用法
rxjs里concatMap operators的用法
rxjs里concatMap operators的用法
105 0
rxjs里concatMap operators的用法
rxjs里combineLatest operators的用法
rxjs里combineLatest operators的用法
99 0
rxjs里combineLatest operators的用法