Delete review
What you learned so far
This part was quite fast! We mainly reused some concepts from previous chapters:
- We created another function in the TaskService class to remove a task from the list.
- We added a button with an event binding to call a function.
- We created a function in the TaskListComponent class to call the deleteTask function from the TaskService class we already injected.
Letβs review the code
We added a delete button in the TaskListComponent
class to remove a task from the list.
We created a deleteTask
function in the TaskListComponent
class to remove a task from the list.
We created a deleteTask
function in the TaskService
class to remove a task from the list.
To provide a better user experience, we added a message when the tasks list is empty.
Whatβs next
In the next chapter, we will learn how to update a task in the list. We will create a form to edit a task and update the task in the list. We will also learn how to use the Angular Router to navigate to the form and back to the list.