I'm using ng-resource to access an API in the following way:
$resource('http://' + config.server.api + config.server.host + base_url + '/:id', {
'id': '@id'
},{
'get' : {
method : 'GET'
},
'add' : {
method : 'PUT'
},
'update' : {
method : 'POST'
},
'all' : {
method : 'GET',
isArray : true
},
'del' : {
method : 'DELETE'
}
},{
stripTrailingSlashes : false
});
And I am accessing the resource like so:
apiService.Businesses.query(function(data){
$scope.businesses = data;
});
However, the request URL is: http://API_URL.com/businesses/:id
Or when I try to use 'resource.get':
apiService.Businesses.get({id:1}, function(data){
$scope.businesses = data;
});
The request URL is http://API_URL.com/businesses/:id/[object%20Object]
I'm obviously missing something in the resource definition but I could not figure out what it was