Doing form validation with angularjs I want to mark all required fields as erroneous when the user click submit.
I am using input.ng-dirty.ng-invalid to style the controls with error. So what I want is to set ng-dirty on required controls (or all controls.. it will be the same for me) when the user submits the form.
Validation is working. I understand why, what I am trying could be wrong, but I found no other way to do the same effect, except something that I think is too complicated to be right.
What I tried was:
<div ng-app>
<form novalidate>
<input name="formvalue" type="text" ng-model="formvalue" required />
<input type="submit" />
</form>
</div>