I need to pass json in the form of List to controller in Angular JS Post.
I have tried to send data in form of Json to get it as list in the MVC
controller. But when I did it , I get only row count at MVC Controller. The
variables in the list are null
Angular Js Controller
$scope.SaveTaxRange = function (){
var tableData = [];
try {
$('#tablTaxRange tbody tr').each(function (index, element) {
//tableData = {};
tableData.push({
Min_amt: $(this).find('th:eq(0) input').val(),
Max_amt: $(this).find('th:eq(1) input').val(),
Tax_percent: $(this).find('th:eq(2) input').val(),
Tax_type: $(this).find('th:eq(3) input').val(),
});
tableData.push({
Min_amt: $(this).find('th:eq(0) input').val(),
Max_amt: $(this).find('th:eq(1) input').val(),
Tax_percent: $(this).find('th:eq(2) input').val(),
Tax_type: $(this).find('th:eq(3) input').val(),
});
});
}catch (e) { alert(e); }
$http({
url: "/PayModule/Pay_mas_taxsetup",
method: "Post",
data: { "model": data }
}).then(function(response){});
};
MVC Model
public class TaxSetupMaster
{
public class TaxRange
{
public string Min_amt;
public string Max_amt;
public string Tax_percent;
public string Tax_type;
public string add;
}
public List<TaxRange> lstTaxRangeSave { get; set; }
}
MVC Controller
[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]
public ActionResult Pay_mas_taxsetup( TaxSetupMaster model)
{
var a = model.lstTaxRangeSave ;//Here it shows rowcount 2 but the
variables are null. Is it feasible to get the data from html?
}
Thanks in advance
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/angular/e7310440-e463-4d72-879a-80b437b5a690%40googlegroups.com.