I am trying to call an API to get some data. In the controller, I do this:
new MyApi.Disconnect('test-item').$save().then(function(response) {...});
This is the service code:
var Disconnect = function (item) {
return $resource('/api/v2/' + item + '/disconnect');
};
return {
'Disconnect': Disconnect
}
item arrives fine here, but I get this error:
TypeError: (intermediate value).$save is not a function
Please advise what am I doing wrong. Thanks!
I found out that this can be done much simpler:
send the item from the controller:
update the returned statement from the service: