From b24c4ae0df677c6bdc08c95a366a2c46b0eb6423 Mon Sep 17 00:00:00 2001 From: k-ta-yamada Date: Tue, 29 Jan 2019 07:58:34 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20IME=E3=81=8CON=E3=81=AE=E5=A0=B4?= =?UTF-8?q?=E5=90=88=E3=81=AB=E5=A4=89=E6=8F=9B=E7=A2=BA=E5=AE=9A=E6=99=82?= =?UTF-8?q?=E3=81=AEEnter=E3=81=A7=E7=99=BB=E9=8C=B2=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=A6=E3=81=97=E3=81=BE=E3=81=86=E7=82=B9=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: https://www.yoheim.net/blog.php?q=20180408 --- .../todo-detail/todo-detail.component.html | 15 ++++++++++++--- .../todo-detail/todo-detail.component.ts | 7 +++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/app/component/todo-detail/todo-detail.component.html b/src/app/component/todo-detail/todo-detail.component.html index bba1e35..9011f3e 100644 --- a/src/app/component/todo-detail/todo-detail.component.html +++ b/src/app/component/todo-detail/todo-detail.component.html @@ -1,6 +1,15 @@
- - + + + +
diff --git a/src/app/component/todo-detail/todo-detail.component.ts b/src/app/component/todo-detail/todo-detail.component.ts index 827366e..3aab015 100644 --- a/src/app/component/todo-detail/todo-detail.component.ts +++ b/src/app/component/todo-detail/todo-detail.component.ts @@ -10,6 +10,8 @@ export class TodoDetailComponent implements OnInit { todo: Todo = new Todo; + keyDownCode: number; + @Output() clickAdd = new EventEmitter(); constructor() { } @@ -17,6 +19,11 @@ export class TodoDetailComponent implements OnInit { ngOnInit() { } + handleKeyUp(e: KeyboardEvent) { + if (e.which !== this.keyDownCode) { return; } + this.add(); + } + add() { this.clickAdd.emit(this.todo); this.todo = new Todo;