I need to store multiple addresses, like address1
, address2
and zipcode
etc.
Should I declare all the fields individually?
for instance:
class A{
// many fields
Address1:string;
Address2:string;
zipCode:number;
city:String;
}
or is there any better way to declare them in entity class? I have been told creating entity classes is the best practice.
CodePudding user response:
If only the addresses are multiple, it seems you have this situation:
class A {
AddressList: string[];
zipCode: number;
city: String;
}
CodePudding user response:
Have you tried something like this?
class Address {
//...
zipCode: string;
city: string;
// ...
}
class A {
addresses: Address[]
}