I have such angularJs script
var formApp = angular.module('formApp', []);
formApp.controller('formController', ['$scope', '$http', function($scope, $http) {
$scope.formData = {};
$scope.processForm = function() {
$http({
method : 'POST',
url : $('form').attr('action'),
data : $scope.formData,
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
})
.success(function(data) {
console.log(data);
if (!data.success) {
$scope.errorName = data.errors.name;
$scope.errorSuperhero = data.errors.superheroAlias;
} else {
$scope.message = data.message;
$scope.errorName = '';
$scope.errorSuperhero = '';
}
});
};
}]);
In my html
<div ng-app="formApp" ng-controller="formController" class="container">
<div class="row">
<div class="col-lg-8 center-block">
<form action="/todo" ng-submit="processForm()">
<label for="login">Login</label>
<input ng-model="formData.login" id="login" type="text" name="" class="form-control" />
<label for="pass">Password</label>
<input ng-model="formData.pass" id="pass" type="password" name="" class="form-control" />
<label for="email">Email</label>
<input ng-model="formData.email" id="email" type="email" name="" class="form-control" />
<input ng-click="Submit" class="btn btn-primary" type="button" value="Register now" />
</form>
</div>
</div>
</div>
But in result my form doesn't send. Nothing happens. I do not know what's wrong doing. Please, help me to solve this problem