Am trying to insert records to database using angular1. when I tried the code below.
It does not work. it seems the insert functions is not properly constructed. can someone help me out. its urgents
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<form>
Name:<input type="text" ng-model="name" />
Email:<input type="text" ng-model="email" />
<input type="button" value="Submit" ng-click="addData()" />
</form>
</div>
<script>
var app = angular.module('myApp',[]);
app.controller('myCtrl',function($scope,$http){
$scope.adData=function(){
'email':$scope.email
}).then(function(response){
console.log("Data addes Successfully");
},function(error){
alert("Data inserts failed");
console.error(error);
});
}
});
</script>