POV
POV

Reputation: 12025

How to pass some parameters in Subject Angular?

There is subject type:

public registerFilter: Subject<any> = new Subject();

I can use it like:

this.registerFilter.next("calendarplan");

How to modify Subject type to pass additional data like this:

this.registerFilter.next("calendarplan", {id: 1, name: "O"});

Upvotes: 0

Views: 2435

Answers (1)

Harun Yilmaz
Harun Yilmaz

Reputation: 8558

Subject is a special type of Observable. It does not accept multiple values in next method.

You need to redesign your way of sending parameters. Like following:

this.registerFilter.next({type: "calendarplan", filter_params: {id: 1, name: "O"}});

For furher reading: https://rxjs-dev.firebaseapp.com/guide/subject

Upvotes: 4

Related Questions