Angular5 + takeWhile不是一个函数

时间:2018-06-01 10:44:50

标签: angular

我有这段代码:

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

有人有想法吗?

1 个答案:

答案 0 :(得分:1)

错误导入我想,试试:

import 'rxjs/add/operator/takeWhile';