#declaration of a subject table
14 messages · Page 1 of 1 (latest)
{} is not a behavuoirSubject. What you are doing is wrong
this is probably your goal:
filterArr: BehaviorSubject<IFilterLocalisation> = new BehaviorSubject<IFilterLocalisation>({});
ok i need a table of BehaviorSubject<IFilterLocalisation>
['mysubject1'] = new BehaviorSubject<IFilterLocalisation>({});
['mysubject2'] = new BehaviorSubject<IFilterLocalisation>({});
you want an object with behaviourSubjects as keys I guess
yes
filterArr: { [x: string]: BehaviorSubject<IFilterLocalisation>; } = {};
just for info, sometimes you create interfaces like this:
export interface MyInterface {
name: string;
age: number;
[x: string]: any;
}
this means you must have name and age and also every other property you want. for example
{
name: "foo",
age: 12,
location: "London",
data: {test:1}
}
but in your case you only want behavuourSubject, therefore --> [x: string]: BehaviorSubject<IFilterLocalisation>;