首页 文章

Angular5 takeWhile不是一个函数

提问于
浏览
1

我有这个代码:

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 回答

  • 1

    错误导入我想,试试:

    import 'rxjs/add/operator/takeWhile';
    

相关问题