From the course: Building Angular and ASP.NET Core Applications

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Deleting data from Angular

Deleting data from Angular

From the course: Building Angular and ASP.NET Core Applications

Start my 1-month free trial

Deleting data from Angular

- [Instructor] The only feature left is deleting data. So, removing a book from our collection. And that is what we are going to do now. So, let's go to visual code. In here, we are going to first create a service method. So, let's go to our service file, which is the book.service.ts and at the end, just after the updateBook, we are going to add the deleteBook method. This method is going us take us a parameter, an I'd of type number. And we are going to send the delete request. So that, we write in here return this.http.delete and then inside here, we write this.baseURL. Then inside double quotes, DeleteBook and the plus ID. Now, let us go to our delete component. And since the delete component is nearly the same like the show book component, we are going to copy the HTML from here. So let's copy the HTML and then go to the deleteBook. And we are going to paste it in here. Let us leave everything the same in here…

Contents