摘要:
1. 创建 ng g s service/list 2.在app.module.ts中引入 import { ListService } from './service/list.service'; @NgModule({ ... providers: [ListService], }) 3.在组件 阅读全文
摘要:
1. 父子组件数据传递 1.1 父传子 @Input() <app-child [message]="message"></app-child> 子组件 import { Input } from '@angular/core'; @Input() message?: string; 1.2 子传父 阅读全文
摘要:
1. ngIf <div *ngIf="flag" id="11"> ngif1</div> 2. ngFor <div *ngFor="let item of books;index as i"> {{i + 1}} - {{item.name}} </div> 3. ngSwith <div [ 阅读全文