Below is my restangular delete request where i intend to pass an array of ids to delete based on user selection
var deleteIds = [1,5,10]
Restangular.all('url').customDELETE(deleteIds);
I want this deleteIds to be passed in body params. How can i send the array as body so tat i could see the request payload.
Actually I also needed to use the delete http method with data passed in the body, and I found that Restangular supports a customOperation
documentation: https://github.com/mgonto/restangular#custom-methods
- customOperation(operation, path, [params, headers, elem]): This does a custom operation to the path that we specify. This method is actually used from all the others in this subsection. Operation can be one of: get, post, put, remove, head, options, patch, trace
example:
Restangular.all('some/path/123')
.customOperation('remove', '',{'content-type': 'application/json'},[1,5,10])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With