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.
Partially updating an item using Angular
From the course: Building Angular and Django Apps
Partially updating an item using Angular
- We're able to create new tour packages, list them, and delete them and now it would be nice to be able to update them as well. So in the rest-api.service we're going to add a new method called updateTour. It's going to take tourPackageData as a parameter. And then we're going to start constructing this API request by extracting some of the data we need to transform before we send it over. And then we're going to call http.put and the URL will be /api/v1/packages. Because we're updating an existing package, we can use the ID that were given in the tour package data. And now the data we're going to send will be the start date, formatted in a specific way, and the tour_length needs to be renamed, and then we pass in the rest of the data. We also need the commonOptions that we use, which would include the oauth token that we need to make this request. Now, in tour-package-controller, we're going to update the save method…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Checking permissions with Django3m 20s
-
(Locked)
Deleting an item using Angular and Django2m 14s
-
(Locked)
Partially updating an item using Angular4m 9s
-
(Locked)
Pagination with Django52s
-
(Locked)
Pagination with Angular3m 29s
-
(Locked)
Filtering with Django2m 38s
-
(Locked)
Filtering with Angular1m 36s
-
(Locked)
Animations in Angular7m 23s
-
(Locked)
-
-
-