Add task deletion.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { AfterViewInit, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { AfterViewInit, Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { Task } from 'src/app/core/entity/task';
|
||||
import { TaskListService } from 'src/app/core/service/task-list.service';
|
||||
@@ -13,6 +13,7 @@ export class TaskDisplayComponent implements AfterViewInit {
|
||||
@Input() task?: Task;
|
||||
titleControl = new FormControl(this.task?.title);
|
||||
isExpanded = false;
|
||||
@ViewChild('titleInput', {static: true}) titleInput?: ElementRef<HTMLInputElement>;
|
||||
|
||||
constructor(
|
||||
private _taskListService: TaskListService
|
||||
@@ -34,4 +35,10 @@ export class TaskDisplayComponent implements AfterViewInit {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
delete(): void {
|
||||
if (this.task) {
|
||||
this._taskListService.delete(this.task);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user