Reputation: 67
I am using the rectangular library with angular.js. I currently have a service called me that represents the currently authenticated user.
services/me
I also have a service called desk that represents that user's current location by returning a single desk object.
services/me/desk
I want to be able to delete the desk to remove a person's current location, by calling a delete request on it. However, whenever I do, restangular adds the id of the desk as a parameter making the url:
services/me/desk/:id
I can't for the life of me figure out how to get it to send a delete request without automatically appending the ID. Please let me know if there is a way to do this within the library.
Thanks!
Upvotes: 0
Views: 765
Reputation: 8079
I assume because the object you are removing was retrieved via Restangular that it's being smart because you have a property called id. Try one of the following. Both should work. They're not connected directly with the object you received:
1.
Restangular.one('services/me/desk').remove().then(
function (response) {
// success
},
function (response) {
// error
});
2.
Restangular.customDELETE("services/me/desk", {}, { 'Content-Type': 'application/json' }).then(
function (response) {
// success
},
function (response) {
// error
});
Upvotes: 1