Angular5 + takeWhile不是一个函数(Angular5+ takeWhile is not a function)

编程入门 行业动态 更新时间:2024-10-25 10:22:42
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 function

Anyone has an idea ?

最满意答案

我想,错误的导入尝试:

import 'rxjs/add/operator/takeWhile';

wrong import I guess, try with:

import 'rxjs/add/operator/takeWhile';

更多推荐

本文发布于:2023-08-04 03:11:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1407310.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:一个函数   takeWhile   function

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!