0

我有一个BehaviorSubject. 我正在尝试将其转换Observable为 aConnectableObservable但我收到错误publishBehaviour不是函数。我究竟做错了什么?

this.questionsArray$.publishBehavior 不是函数类型错误:this.questionsArray$.publishBehavior 不是函数

代码片段是

private questionsArraySubject: BehaviorSubject<Result>; 
questionsArray$: Observable<Result>;
questionsArrayConnectable$:ConnectableObservable<Result>;

this.questionsArraySubject = new BehaviorSubject<Result>(new Result('initial',{}));

// create Observable. Other components can subcribe to it now to get notifications/values
this.questionsArray$ = this.questionsArraySubject.asObservable(); 
this.questionsArrayConnectable$ = this.questionsArray$.publishBehavior(new Result('initial',{}))
4

0 回答 0