I am having issues with finding the correct way to send an array of objects to my API using AngularJS.
FrontEnd Code
function getPrices(articles) {
return $http.get('http://someurl/api/prices/getprices', { params: { articles: articles } }).then(function (res) {
// do something with prices
}, function (err) {
// handle error
});
}
Articles are of the type
var oneArticle = {
code: 'someCode',
quantity: 1,
stockUnit: 'piece'
}
Api code
[VersionedRoute("getprices")]
[HttpGet]
public IHttpActionResult GetPrices([FromUri]List<Article> articles) {
// do something with input
}
Article class
public class Article {
public string Code {get;set;}
public int Quantity {get;set;}
public string StockUnit {get;set;}
}
Some questions:
1) Why do I not receive any data on my API. Articles is always null
2) Is this the right approach?
Thanks
EDIT 1: Using a post option I receive following data in my request but I still don't know how to handle it on the API.

return $http.get('http://someurl/api/prices/getprices', articles })articles is a list