December 2017
Beginner
372 pages
10h 32m
English
This function will be called when the user is done typing in the input area and presses Enter. The purpose of this function would be to add a new task to our list of tasks for the board. The following is the code for the same:
addtaskOnEnter(event: KeyboardEvent) { if (event.keyCode === 13) { if (this.addtaskText && this.addtaskText.trim() !== '') { this.addtask(); } else { this.clearAddtask(); } } else if (event.keyCode === 27) { this.clearAddtask(); } }
This method internally calls a couple of other functions, addtask and clearAddtask.
In a call to this method, we pass an event of type KeyBoardEvent from the UI, which will provide the information of the key pressed by the user.
If the key pressed is ...
Read now
Unlock full access