Angular code is below. Please look if I am missing something in post request -
<script>
var app = angular.module("myApp", [])
.controller("myControllerSubmit", function ($scope, $http) {
$scope.submit = function () {
var Employee = { empID: $scope.empId, Name: $scope.empName, Gender: $scope.empGender }
$http(
{
method: 'POST',
url: 'http://localhost:58365/home/saveEmpData',
data: Employee,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function (response,status,headers,config) {
$scope.data1 = response.data;
})
}
})
</script>
In webApi I am getting null Employee object
[HttpPost]
public void saveEmpData( Employee emp)
{
if (emp.Name != null)
{
var objempList = new DAL();
objempList.saveData(emp);
}
}