Here data is not inserting ...it showing error in the client side only....
Can any one help me ???
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link href="bootstrap-3.3.7/css/bootstrap.css" rel="stylesheet" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.5/angular.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript">
var app = angular.module("myApp", []);
app.controller("myCntrl", function ($scope, myService) {
$scope.SaveUser = function () {
var User = {
Name: $scope.txtName,
Age: $scope.txtAge,
};
var response = myService.AddUser(User);
response.then(function (data) {
alert("User Created !");
});
}
});
app.Service("myService", function ($http) {
debugger;
this.AddUser = function (User) {
var response = $http({
method: "post",
url: "/Register/AddUser",
data: JSON.stringify(User),
dataType: "json"
});
return response;
}
});
</script>
</head>
<body ng-app="adventureModule">
<div class="col-md-4 col-md-offset-4" ng-controller="personCtrl">
<h3 class="text-center text-primary">Enter the Employee Details</h3>
<input type="text" class="form-control" placeholder="Enter name" ng-model="txtName" /><br />
<input type="text" class="form-control" placeholder="Age" ng-model="txtAge" /><br />
<input type="button" class="btn btn-primary form-control" data-ng-click="SaveUser();" value="Submit" />
</div>
</body>
</html>