The model

The model in Angular is a plain class, as we are using TypeScript. It can look like the following code:

// mvc/MvcExample/src/app/product.model.ts

export class Product {
constructor(
private id: number,
private title: string,
private description: string,
private created: Date
) {}

method() {}

anotherMethod() {}
}

It is a plain TypeScript file, or rather an ES2015 module, not to be confused with an Angular module. We will discuss in the next main section what an Angular module is, in terms of setup and how it is consumed. For now, remember the model is a simple thing.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.180.161