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
Expanding from @ReklatsMasters's answer, if you want to change a value before submitting the form, you could do like so...
.directive("ngFormCommit", [function(){
return {
require:"form",
link: function($scope, $el, $attr, $form) {
$form.commit = function($newCurrency) {
$el[0].querySelector('#currency_code').value = $newCurrency;
$el[0].submit();
};
}
};
}])
.controller("AwesomeCtrl", ["$scope", function($scope){
$scope.save = function($newCurrency, $form) {
if ($form.$valid) {
$form.commit($newCurrency);
}
};
}])