- 1、ngFor
<div *ngFor='let i of itm'>{{i}}<div/>
- 2、(click)延迟处理
<!-- tappable 解决click延迟 -->
<div tappable (click)='goDetails(12)'>
点击
</div>
- 3、ngClass
<div [ngClass]="{active: isActive}"> //栗子一
<div [class.active]="isActive"> //栗子二
- 3、NgIf
<div *ngIf="false"></div>
- 4、NgSwitch
<div class="container">
<div *ngIf="myVar == 'A'">Var is A</div>
<div *ngIf="myVar == 'B'">Var is B</div>
<div *ngIf="myVar == 'C'">Var is C</div>
<div *ngIf="myVar != 'A' && myVar != 'B' && myVar != 'C'">
Var is something else
</div>
</div>
5、创建页面
ionic g page xxx