I am using asp.net core MVC 3.1.0. I make a call from AngularJS to MVC controller to submit form. But the parameter object is passing null to controller:
AngularJS:
$scope.minfo = 0;
$scope.submit = function () {
var model = {"obj": {"Email": $scope.email,"Password": $scope.pw,"memberInformed":$scope.minfo};
return $http({
method: 'POST',
url: '/Home/Register',
data: model
});
};
Controller c#:
[AllowAnonymous]
[HttpPost]
public IActionResult Register(Register obj)
{
//...
return View();
}
Update: boolean input field:
<input type="checkbox" name="minfo" ng-model="minfo" ng-true-value="1" ng-false-value="0" required />
I can send parameters without memberInformed
boolean parameter. Otherwise the object is null. Thanks for the answers.