Angularjs prevent form submission when input validation fails
You can do:
<form name="loginform" novalidate ng-submit="loginform.$valid && login.submit()">
No need for controller checks.
Change the submit button to:
<button type="submit" ng-disabled="loginform.$invalid">Login</button>
So the suggested answer from TheHippo did not work for me, instead I ended up sending the form as a parameter to the function like so:
<form name="loginform" novalidate ng-submit="login.submit(loginForm)" class="css-form">
This makes the form available in the controller method:
$scope.login = {
submit : function(form) {
if(form.$valid)....
}