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

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -