我将数组数据从angularjs传递给mvc控制器
This is my angularjs code
$http({
url: '/Login/InsertDetails',
method: 'POST',
data: JSON.stringify(Data),
headers: { 'content-type': 'application/json' }
})
Json Data
$scope.details = [{
name: "ammin",
age: "16",
city: "NY",
add: "true",
sal: 100
}, {
name: "joe",
age: "80",
city: "CH",
add: false,
sal: 200
}];
var Data = {
one: $scope.details
}
在我的控制器中,我有方法Insert with list parameter
public JsonResult Insert(List<Personel> P)
{
}
View Model类就像这样
public class Personel
{
public string name { get; set; }
public int age { get; set; }
public string city { get; set; }
public string add { get; set; }
public string sal { get; set; }
}
但是当我从angularjs发布数据时,我在动作方法中获取空值。我应该在动作方法中使用什么类型的参数