[英]Resetting RxJs in Angular2
I have a the following properties 我有以下属性
private messages$: BehaviorSubject<Array<MessageModel>>;
public readonly messages: Observable<Array<MessageModel>>;
I'm pushing new messages with this.messages$.next(...)
, but at some point I want to clear the pushed data. 我正在使用this.messages$.next(...)
推送新消息,但有时我想清除推送的数据。 I read about the empty()
method, but when I try to use it with this.messages
It says that the Observable<Array<MessageModel>>
has no such method. 我读到有关empty()
方法的信息,但是当我尝试将它与this.messages
一起使用时,它说Observable<Array<MessageModel>>
没有这种方法。 I try import 'rxjs/add/operator/map'
, but it still doesn't work. 我尝试import 'rxjs/add/operator/map'
,但仍然无法正常工作。
清除值使用
this.messages$.next()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.