I want to pass data what has list of child like here
{
id : 1,
title : 'test',
childs : [
{ id : 1, name: 'name1' },
{ id : 2, name: 'name2' },
{ id : 3, name: 'name3' }]
}
I want it pass to web api controller
public IHttpActionResult Post(Batche model){
return model;
}
and batch
public class Batche
{
public long Id { get; set; }
public string title{ get; set; }
public ICollection<BatchDetail.BatchDetail> BatchDetails { get; set; }
}
and batch details
public class BatchDetails(){
public long Id { get; set; }
public string Name{ get; set; }
}
when I post data get me null
$http({
method : 'POST',
url : baseUrl + "api/MyController",
data : $scope.model
})
You can use factory and controller for pass data from client to server side (etc. web api controller or mvc controller). For example, you can create angular factory:
And, create angular controller:
In wep api controller you can create function just like that:
If you have more questions, please write... Happy coding...