I found out the Problem. The issue is with Typo Error.  its should be
$scope.addData  and not  $scope.adData. i omitted d letter.

Thanks all

On Wed, Nov 24, 2021 at 3:46 PM Blessing Augustine <augustineb...@gmail.com>
wrote:

> 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(){
>             $http.post("test.php", {
>                 'name':$scope.name,
>                 'email':$scope.email
>             }).then(function(response){
>                     console.log("Data addes Successfully");
>                 },function(error){
>                     alert("Data inserts failed");
>                     console.error(error);
>
>                 });
>             }
>         });
>     </script>
>
> --
> 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 angular+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/angular/0b481371-7fd7-4631-8b22-fe9dd817f962n%40googlegroups.com
> <https://groups.google.com/d/msgid/angular/0b481371-7fd7-4631-8b22-fe9dd817f962n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 angular+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/CADW%2Bj9sBNGRuow%3DcBrXa2xdSAby4QeL5x24jEeg1MixB1AahZQ%40mail.gmail.com.

Reply via email to