[Answered ]-AngularJS and ModelForm: Submit button not working

2👍

You should handle submitting the form with angular

<form ng-submit="myFunc(myData)">
    <input type="text" ng-model="myData.name">
    <input type="text" ng-model="myData.phone">
    <button type="submit">Submit</button>
</form>

OR

<form >
    <input type="text" ng-model="myData.name">
    <input type="text" ng-model="myData.phone">
    <button ng-click="myFunc(myData)">Submit</button>
</form>

and your controller:

 var app = angular.module('myApp', []);
  app.controller('myCtrl', function($scope){
    $scope.myData= {name:'' , phone:''};  
    $scope.myFunc = function(data) {
      console.log(data);
      // data(myData array) can be send with angular $http.post() method 
      // e.g. : $http.post('/myUrl/', data)
    }
  })

Update:

Here is a good tutorial for angular $http service!

Leave a comment