How modify save
method for put, if id
specified and post if not?
I mean:
Posts.save({id: 1, content: "..."}) // PUT /posts/1
Posts.save({content: "..."}) // POST /posts
How modify save
method for put, if id
specified and post if not?
I mean:
Posts.save({id: 1, content: "..."}) // PUT /posts/1
Posts.save({content: "..."}) // POST /posts
It seems you cannot do that in normal way. If you want to update just create your own update function in resource like:
app.factory('Posts', ['$resource', function($resource) {
return $resource('/posts/:id', null,
{
'update': { method:'PUT' }
});
}]);