From the course: Building Angular and Django Apps

Unlock the full course today

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

Deleting an item using Angular and Django

Deleting an item using Angular and Django

From the course: Building Angular and Django Apps

Start my 1-month free trial

Deleting an item using Angular and Django

- [Instructor] To delete an item, we need to send an http request from Angular to Django. Let's update the rest API service to make that call in a delete tour method. Go to the bottom of rest API service, and we create delete tour, it accepts an ID, and then it's going to return the result of calling http client delete and its point to api v1 slash packages with the package ID that we want to delete and then we provide the olof token in the headers. Now in the tour package controller, we also need to implement a delete method. This one however will take a tour package. We're expecting that it will have an ID in that object and we're going to return the result of calling rest API service, delete tour, the tour package ID. Our tour package list component already has found the delete buttons for each package in the list to delete tour. So all we have to do is fill it in. We can call tour package controller delete…

Contents