【问题标题】:Property 'combineLatest' doesnt exist on type 'Observable<any>''Observable<any>' 类型上不存在属性 'combineLatest'
【发布时间】:2021-02-19 09:04:56
【问题描述】:

您好,我正在使用 RxJS combineLatest 运算符并收到此错误。有人可以让我知道我应该做些什么改变

【问题讨论】:

    标签: angular rxjs observable combinelatest


    【解决方案1】:
    1. 请不要发布代码截图。这使得重现问题变得很愚蠢。
    2. 在最新版本的 RxJS 中,combineLatest 是静态的,类似于 forkJoin。因此,您需要从中初始化一个可观察对象。请参阅 v5 -> v6 migration guide 并搜索 combineLatest
    import { combineLatest } from 'rxjs';
    
    this.searchResult = combineLatest(this.searchQuery$, this.listMachines).pipe(...);
    

    【讨论】:

      猜你喜欢
      • 2017-10-20
      • 2016-09-01
      • 2017-08-10
      • 1970-01-01
      • 1970-01-01
      • 2016-10-26
      • 2019-01-25
      • 2018-11-16
      • 2020-11-01
      相关资源
      最近更新 更多