|
|
@ -1,17 +1,19 @@ |
|
|
|
import { Component } from '@angular/core'; |
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
|
|
|
|
import { Task } from './task'; |
|
|
|
import { TaskService } from './task.service'; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: 'my-app', |
|
|
|
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' }), |
|
|
|
]; |
|
|
|
export class AppComponent implements OnInit { |
|
|
|
tasks!: Task[]; |
|
|
|
|
|
|
|
constructor(private taskService: TaskService) {} |
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
this.tasks = this.taskService.getTasks(); |
|
|
|
} |
|
|
|
} |