服务
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}}
});
});
控制器:
$scope.updateRow = function(od){
var order = od;
order.$updateRow();
}
Order.get()和Order.query()工作正常。但是当我尝试调用我的自定义函数时,它会给出错误:order。$ updateRow不是函数
任何人都可以帮忙解决这个错误的原因吗?
答案 0 :(得分:-1)
试试这个,
$scope.updateRow = function(od){
Order.updateRow({id: od});
}