Service
sampleApp.factory('Order', function ($resource, $cacheFactory) {
return $resource('http://example.com/api/v1/orders/:id', {id: '@id'},
{
'query': {method:'GET', cache: true},
'get': {method:'GET'},
'updateRow': {method:'POST', params:{charge:true}},
'deleteRow': {method:'POST', params:{charge:true}},
'changeStatus': {method:'POST', params:{charge:true}}
});
});
Controller:
$scope.updateRow = function(od){
var order = od;
order.$updateRow();
}
Order.get() and Order.query() works fine. but when i try to call my custom function it is giving error: order.$updateRow is not a function
Can anyone help why is this error?
try this,
$scope.updateRow = function(od){
Order.updateRow({id: od});
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.