I like to have data model class, which should hold same information for two persons at same time.. E.g.
export class persons {
constructor(
public person1Name:string = '',
public person1Age:number = 0,
public person1Game: string ='',
public person2Name:string = '',
public person2Age:number = 0,
public person2Game: string ='',
){}
}
So it has same information (i.e. name, age, game) for two persons.
I know, I can have a generic person model class, but problems is, I always send exactly two persons information from a angular service to the component.
In case of generic person class, I have to send an array of objects like:
Array: [person1, person2]
In that case, in service as well as in component, will be difficult to manage, because I'm using information in different ways.
More importantly, I'm sending information of two persons from service through observable.
The question is, can I have model class which represents same information for two persons as mentioned above? because I really like to avoid array of objects..
Thanks in advance..