August 2017
Beginner
298 pages
7h 4m
English
Inside ToDoClass, include the two new methods:
toggleTaskStatus(index) { this.tasks[index].isComplete = !this.tasks[index].isComplete; this.loadTasks(); } deleteTask(event, taskIndex) { event.preventDefault(); this.tasks.splice(taskIndex, 1); this.loadTasks(); }
The first method, toggleTaskStatus(), is used to mark a task as completed or incomplete. It is called when a checkbox is clicked (onChange) with the index of the task, which was clicked as the parameter:
Read now
Unlock full access