I recently watched a Tutorial on Angular 2 with TypeScript, but unsure when to use an Interface and when to use a Model for data structures.
Example of interface:
export interface IProduct {
ProductNumber: number;
ProductName: string;
ProductDescription: string;
}
Example of Model:
export class Product {
constructor(
public ProductNumber: number,
public ProductName: string,
public ProductDescription: string
){}
}
I want to load JSON data from a URL and bind it to the Interface/Model. Sometimes I want a single data object, other times I want to hold an array of the object.
Which one should I use and why?