I am trying to use the following code to communicate with a RESTFul service:
$scope.makeRequest = function(){
params = {};
params['3'] = 'X';
params['length'] = 5;
var resource = $resource('/foo', {});
var result = resource.query(params, function(){
console.log(result);
});
}
This request works, and calls the expected url: http://localhost:3000/foo?3=X&length=5
However, when the integer field is the value of the 'length' field minus one:
$scope.makeRequest = function(){
params = {};
params['4'] = 'X';
params['length'] = 5;
var resource = $resource('/foo', {});
var result = resource.query(params, function(){
console.log(result);
});
}
This snippet ignores the 'length' field, and makes a request to: http://localhost:3000/foo?4=X
My questions are:
Have you try to just set up an literal object like this:
params = {'4':'X', 'length': '5'}