Suppose I have a resource set up like this:
resource = $resource(
"http://foo.com/service/:type/:id",
{},
{save: {method:'PUT', params: {type:'@type', id: '@id'}}}
);
resource.save({type:'user', id:14, name:'Bob Dole'});
Is there any way I can prevent type
and id
from being submitted as part of the request body, and just send name
in the PUT payload? I don't control the API I am submitting to, and it seems to not like the extra parameters I am sending it.
Thanks!
Update - 10/25/13 - 13:38
The documentation for resource says this:
If the parameter value is prefixed with @ then the value of that parameter is extracted from the data object (useful for non-GET operations).
That implies that this ought to remove the parameters from the data:
resource.save({type:'@user', id:'@14', name:'Bob Dole'});
but it doesn't seem to work. Still at a loss.