天天看点

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));

rxjs里switchMap operators的用法
rxjs里switchMap operators的用法
rxjs里switchMap operators的用法