Questions Management – Frontend – Build category deletion using Angular

Check out the full series of Questions Management tutorial here.

We have prepared the necessary information to build category deletion using Angular in the Frontend section of our Questions Management application such as a CategoryService for calling the API Category Service, a Category object for containing the information of a category, the section displays all the categories in the system. Now we will go into the details of the construction of this category deletion.

First, I will add a method in the CategoriesService to call the API Category Service for removing the category, as follows:

Next, I will modify the code of the button delete in the table display all categories as follows:

We need the user to confirm each time they click the Delete button so in the CategoriesComponent class, I will add a new method for the delete section with the following content:

At this point, we have completed the construction of the category deletion for the Frontend section of the QuestionsManagement application. Let’s run the test.



Suppose, I currently have the following categories:

Questions Management – Frontend – Build category deletion using Angular

Now, if you click the delete category with code is 123ABC, you will see a window to confirm the deletion:

Questions Management – Frontend – Build category deletion using Angular

If you really want to delete then you just press OK button is okay.

Add Comment