I'm using Angular's $http.get()
method to query my API:
var arr = ['foo','bar'];
return $http.get("api/foo", {
params: { sampleids: arr}
});
This results in a request to /api/foo?sampleids=115&sampleids=116
which works ok. If I reduce the size of the array to a single element, however, it becomes /api/foo?sampleids=115
, which express (node.js) fails to interpret as an array.
If Angular sent the query as /api/foo?sampleids[]=115
instead, it should work fine. Is there any way I can tell it to do that?