Angular5 + takeWhile不是一个函数(Angular5+ takeWhile is not a function)
我有这样的代码:
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任何人有想法?
I have this code :
public ngOnInit(){ this.schemeStore.getSchemesByAffId() .takeWhile(() => this.isAlive) .subscribe((schemes: Scheme[]) => { const currId = schemes[0].currency; this.schemeFunds$ = this.fundStore .getSchemeValorizationsByCurrency(currId); }); }I even imported the takeWhile with :
import { takeWhile } from 'rxjs/operators';But i have this error message :
ERROR TypeError: this.schemeStore.getSchemesByAffId(...).takeWhile is not a functionAnyone has an idea ?
最满意答案
我想,错误的导入尝试:
import 'rxjs/add/operator/takeWhile';wrong import I guess, try with:
import 'rxjs/add/operator/takeWhile';更多推荐
发布评论