官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 桂平市| 南宁市| 洛阳市| 淮滨县| 浮梁县| 伊宁市| 江城| 南投县| 浪卡子县| 永济市| 汉源县| 黄平县| 长沙市| 南溪县| 大厂| 三明市| 前郭尔| 南溪县| 札达县| 芜湖县| 湟中县| 镇赉县| 阜新市| 上林县| 中宁县| 涞水县| 民勤县| 石河子市| 东明县| 天津市| 什邡市| 夏津县| 察隅县| 汝州市| 萍乡市| 齐齐哈尔市| 怀宁县| 西华县| 古蔺县| 霍城县| 凯里市|