ruby on rails - Make a PATCH or PUT request using $resource -
I am trying to create an update function in an angle controller:
$ Scope .update = function (product) {product. $ Save (); $ Scope.cancelEdit (); }
There are two ways to update a resource in my backend:
PATCH /products/:id(.:format) PUT / products /: Id (.: Format)
However, I can not access any of these using the $ resource
! , I can either use these functions to send requests with some tasks:
{get}: {method: 'get'}, 'save': {method: POST '},' Query ': {method:' GET ', isArray: true},' remove ': {method:' DELETE '},' delete ': {method:' DELETE '}};
So what does it mean to send me a patch or put request?
How should I configure my APP Central?
These are only the default, but you can define your own actions.
$ resource (url, paramDefaults, {put: {method: 'PUT'}, patch: {method: 'PATCH'},});
Comments
Post a Comment