I\'d like to do a traditional form submit from within a controller. The scenario is that I want to hit a route on my web server and redirect to its response, which I can do
You can add submit method to a FormController. I did so:
.directive("ngFormCommit", [function(){
return {
require:"form",
link: function($scope, $el, $attr, $form) {
$form.commit = function() {
$el[0].submit();
};
}
};
}])
.controller("AwesomeCtrl", ["$scope", function($scope){
$scope.save = function($form) {
if ($form.$valid) {
$form.commit();
}
};
}])