《CSS3艺术:网页设计案例实战》的目录,按照章节,进行二级数据组织,以便于导航。
1、在src/app文件夹下,建立model文件夹
2、在model文件夹中,建立section.model.ts文件,并建立Section类,用于存放“节”
export class Section {
constructor(
public id: number,
public title: string,
public link: string
) { }
}
3、在model文件夹中,建立chapter.model.ts文件,并建立Chapter类,用于存放“章”
import { Section } from "./section.model";
export class Chapter {
constructor(
public id: number,
public title: string,
public sections:Section[]
){}
}
4、在model文件夹中建立model模块
ng g m model/model
angular/cli在src/app/model文件夹下建立model.module.ts的文件
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
@NgModule({