Browse Source

ngSwitch 多條件判斷

master
HarveyChou 2 years ago
parent
commit
7f6d0b3765
  1. 3
      src/app/app.component.html
  2. 7
      src/app/task/task.component.html

3
src/app/app.component.html

@ -8,6 +8,5 @@
</ng-template>
<ng-template #list>
<app-task *ngFor="let task of tasks; let odd=odd" [class.odd]="odd"
[task] = "task"></app-task>
<app-task *ngFor="let task of tasks; let odd = odd" [class.odd]="odd" [task]="task"></app-task>
</ng-template>

7
src/app/task/task.component.html

@ -1,2 +1,7 @@
<span>{{ task.TaskSn }} </span>
<span>{{task.TaskName}}</span>
<div [ngSwitch]="task.State">
<div *ngSwitchCase="'Doing'">進行中</div>
<div *ngSwitchCase="'Finish'">已完成</div>
<div *ngSwitchDefault>未安排</div>
</div>
Loading…
Cancel
Save