本文介绍了类型"Observable< {}>"上不存在属性"next"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试执行以下操作

let o = new Observable() ;
o.delay( 3000 ).next( { stuff } ) ;

出现以下错误

也尝试过

Let o = new Subject();
o.delay( 3000 ).next( { stuff } ) ;

仍然得到

推荐答案

您需要在Subject实例上调用next.然后,示例中的o变量是Subject与返回Observable的运算符链接在一起.

You need to call next on the Subject instance. The o variable from your example is then the Subject chained with the operator that returns an Observable.

const s = new Subject();
const o = s.delay(3000);

o.subscribe(...);

s.next();

这篇关于类型"Observable< {}>"上不存在属性"next"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-25 14:36
查看更多