bugfix
This commit is contained in:
parent
79d8d3ce30
commit
4c3d037152
2 changed files with 15 additions and 0 deletions
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
<form
|
||||
(ngSubmit)="onSubmit(taskForm, overlayData)"
|
||||
(keydown.enter)="handleEnterKey($event)"
|
||||
#taskForm="ngForm"
|
||||
onsubmit="return false"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -192,6 +192,20 @@ export class AddTaskComponent {
|
|||
this.taskData.subtasksDone = [];
|
||||
}
|
||||
|
||||
handleEnterKey(event: Event) {
|
||||
event.preventDefault();
|
||||
if (event instanceof KeyboardEvent) {
|
||||
if (event.target instanceof HTMLInputElement) {
|
||||
const inputField = event.target as HTMLInputElement;
|
||||
if (inputField.name === 'subtask') {
|
||||
this.addSubtask(inputField.value);
|
||||
inputField.value = '';
|
||||
this.subtaskValue = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onSubmit(ngForm: NgForm, overlayData: string) {
|
||||
if (ngForm.submitted && ngForm.form.valid) {
|
||||
if (overlayData === '') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue