Initial Commit
This commit is contained in:
27
frontend/src/app/table/table.component.ts
Normal file
27
frontend/src/app/table/table.component.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import {Component, inject, Signal} from '@angular/core';
|
||||
import {TodoService} from "../service/todo.service";
|
||||
import {DatePipe} from "@angular/common";
|
||||
import {GetTask} from "../dto/models";
|
||||
import {toSignal} from "@angular/core/rxjs-interop";
|
||||
|
||||
@Component({
|
||||
selector: 'app-table',
|
||||
standalone: true,
|
||||
imports: [
|
||||
DatePipe
|
||||
],
|
||||
templateUrl: './table.component.html',
|
||||
styleUrl: './table.component.css'
|
||||
})
|
||||
export class TableComponent {
|
||||
todoService: TodoService = inject(TodoService);
|
||||
todos = this.todoService.todos;
|
||||
|
||||
markAsDone(todo: GetTask) {
|
||||
this.todoService.markAsDone(todo).subscribe(() => {this.todos.reload()});
|
||||
}
|
||||
|
||||
delete(id: number) {
|
||||
this.todoService.delete(id).subscribe(() => {this.todos.reload()});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user