bozhidarc
bozhidarc

Reputation: 854

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. 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. I try import 'rxjs/add/operator/map', but it still doesn't work.

Upvotes: 1

Views: 974

Answers (1)

Julia Passynkova
Julia Passynkova

Reputation: 17899

To clear the value use

this.messages$.next()

Upvotes: 1

Related Questions