打赏

2024年3月24日

摘要: 1. 创建 ng g s service/list 2.在app.module.ts中引入 import { ListService } from './service/list.service'; @NgModule({ ... providers: [ListService], }) 3.在组件 阅读全文
posted @ 2024-03-24 14:10 jlyuan 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 1. 父子组件数据传递 1.1 父传子 @Input() <app-child [message]="message"></app-child> 子组件 import { Input } from '@angular/core'; @Input() message?: string; 1.2 子传父 阅读全文
posted @ 2024-03-24 13:17 jlyuan 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 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 [ 阅读全文
posted @ 2024-03-24 10:48 jlyuan 阅读(2) 评论(0) 推荐(0) 编辑

导航