小编Pha*_*aze的帖子

Angular 6 ng lint combineLatest已弃用

我最近从Angular 5更新到Angular 6.

我收到了这个警告combineLatest is deprecated: resultSelector no longer supported, pipe to map instead.Rxjs是版本6.1.0,tslint是5.10.0,Angular CLI是6.0.0和Typescript 2.7.2.我这样使用它:

const a$ = combineLatest(
  this.aStore.select(b.getAuth),
  this.cStore.select(b.getUrl),
  (auth, url) => ({auth, url}),
);
Run Code Online (Sandbox Code Playgroud)

我也尝试过这样:

empty().pipe(
combineLatest(...),
  ...
)
Run Code Online (Sandbox Code Playgroud)

但是这给了我:combineLatest is deprecated: Deprecated in favor of static combineLatest而且对于静态版本也不推荐使用empty.

rxjs tslint angular angular6

22
推荐指数
3
解决办法
2万
查看次数

当条件不满足时取消 Observable 中链

是否可以在链中取消 Observable?假设我们有一些相互依赖的事件链,如果其中一个事件链失败,则无需继续。

observable_1.pipe(
  take(1),
  switchMap((result_1) => {
    // Do something that requires observable_1 and return something
    // If it fails, there is no point to proceed
    // If it succeeds, we can continue
  }),
  switchMap((result_2) => {
    // Do something that requires result_2 and return something
    // If it fails, there is no point to proceed
    // If it succeeds, we can continue
  }),
  // etc...
);
Run Code Online (Sandbox Code Playgroud)

rxjs typescript ngrx angular

5
推荐指数
1
解决办法
1091
查看次数

标签 统计

angular ×2

rxjs ×2

angular6 ×1

ngrx ×1

tslint ×1

typescript ×1