angularjs - Angular sends the ID in the request body instead of URL -
here resource definition:
app.factory('program', ['$resource', function ($resource) { return $resource(host + '/rest/program/:id/:action', {}, {query: {method: 'get', isarray: false}}); }]);
when call program.save({id:3,name:'foo'});
sends request post /rest/program
, places {id:3,name:'foo'}
in request body. shouldn't send update request /rest/program/3
, put {name:'foo'}
in request body.
try this:
app.factory('program', ['$resource', function ($resource) { return $resource(host + '/rest/program/:id/:action', { id: '@id', action: '@action' }, { query: { method: 'get', isarray: false } }); }]);
you might need pass them parameters too.
Comments
Post a Comment