|
@ -1,28 +1,29 @@ |
|
|
import { Component } from '@angular/core'; |
|
|
|
|
|
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
|
|
|
|
|
import { Task } from './task'; |
|
|
import { Task } from './task'; |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
selector: 'my-app', |
|
|
selector: 'my-app', |
|
|
templateUrl: './app.component.html', |
|
|
templateUrl: './app.component.html', |
|
|
styleUrls: [ './app.component.css' ] |
|
|
|
|
|
|
|
|
styleUrls: ['./app.component.css'], |
|
|
}) |
|
|
}) |
|
|
export class AppComponent { |
|
|
|
|
|
tasks: Task[] = [ |
|
|
|
|
|
new Task({ TaskSn: '001', TaskName: '待辦事項 A', State: 'Finish' }), |
|
|
|
|
|
new Task({ TaskSn: '002', TaskName: '待辦事項 B', State: 'Doing' }), |
|
|
|
|
|
new Task({ TaskSn: '003', TaskName: '待辦事項 C', State: 'None' }), |
|
|
|
|
|
new Task({ TaskSn: '004', TaskName: '待辦事項 D', State: 'None' }), |
|
|
|
|
|
]; |
|
|
|
|
|
trackByItems(index:number, task:Task):string{ |
|
|
|
|
|
return task.TaskSn; |
|
|
|
|
|
|
|
|
export class AppComponent implements OnInit { |
|
|
|
|
|
tasks!: Task[]; |
|
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
|
this.onLoad(); |
|
|
} |
|
|
} |
|
|
onReset():void{ |
|
|
|
|
|
this.tasks=[ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onLoad(): void { |
|
|
|
|
|
this.tasks = [ |
|
|
new Task({ TaskSn: '001', TaskName: '待辦事項 A', State: 'Finish' }), |
|
|
new Task({ TaskSn: '001', TaskName: '待辦事項 A', State: 'Finish' }), |
|
|
new Task({ TaskSn: '002', TaskName: '待辦事項 B', State: 'Doing' }), |
|
|
new Task({ TaskSn: '002', TaskName: '待辦事項 B', State: 'Doing' }), |
|
|
new Task({ TaskSn: '004', TaskName: '待辦事項 C', State: 'None' }), |
|
|
|
|
|
new Task({ TaskSn: '005', TaskName: '待辦事項 D', State: 'None' }), |
|
|
|
|
|
|
|
|
new Task({ TaskSn: '003', TaskName: '待辦事項 C', State: 'None' }), |
|
|
|
|
|
new Task({ TaskSn: '004', TaskName: '待辦事項 D', State: 'None' }), |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onClear(): void { |
|
|
|
|
|
this.tasks = []; |
|
|
|
|
|
} |
|
|
} |
|
|
} |