(js) Resource.post: argument 'id' is optional

pull/91/head
Francis Lachapelle 2015-05-01 09:54:49 -04:00
parent fc3c362515
commit 523532b153
1 changed files with 4 additions and 1 deletions

View File

@ -130,7 +130,10 @@
*/
Resource.prototype.post = function(id, action, data) {
var deferred = this._q.defer(),
path = this._path + '/' + id + '/' + action;
path = [this._path];
if (id) path.push(id);
if (action) path.push(action);
path = _.compact(_.flatten(path)).join('/');
this._http
.post(path, data)