Angular 角度5+;takeWhile不是一个函数

Angular 角度5+;takeWhile不是一个函数,angular,Angular,我有以下代码: public ngOnInit(){ this.schemeStore.getSchemesByAffId() .takeWhile(() => this.isAlive) .subscribe((schemes: Scheme[]) => { const currId = schemes[0].currency; this.schemeFunds$ = this.fundStore .getSchemeValorization

我有以下代码:

public ngOnInit(){
  this.schemeStore.getSchemesByAffId()
  .takeWhile(() => this.isAlive)
  .subscribe((schemes: Scheme[]) => {
    const currId = schemes[0].currency;
    this.schemeFunds$ = this.fundStore
      .getSchemeValorizationsByCurrency(currId);
  });
}
我甚至在导入takeWhile时使用了:

import { takeWhile } from 'rxjs/operators';
但我有一条错误信息:

ERROR TypeError: this.schemeStore.getSchemesByAffId(...).takeWhile is not a function

有人有想法吗?

我猜导入错误,请尝试:

import 'rxjs/add/operator/takeWhile';

您正在使用rxjs6导入,因此需要将其与
管道一起使用
,否则将导入更改为
导入'rxjs/add/operator/takeWhile'
谢谢,我错过了它。。。!