Reputation: 2196
This is my resource:
socialnetworkServices.factory('UpdateResource',
[
'$resource',
'$q',
function($resource, $q){
return {
update: function (url, sendParams) {
return $resource(
url,
null,
{
'update': {
method:'PUT',
headers: {
'Content-Type': 'application/json'
},
params:
sendParams
}
}).update();
}
}
}]);
My problem is when call this method update the object (sendParams) send in url and not in the body of request.
PD: I don't know how put pretty the code, sorry
Upvotes: 1
Views: 64
Reputation: 866
You are using the params
in your $resouce
wrong. The payload you want to send has to be the argument of the actual update
call you are doing:
socialnetworkServices.factory('UpdateResource', [
'$resource',
'$q',
function($resource, $q) {
return {
update: function(url, sendParams) {
return $resource(
url,
null, {
'update': {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
}
}
}).update(sendParams); // Put your payload parameters here
}
}
}
]);
Upvotes: 2