You should be using ng-submit instead of ng-click, since ng-click (in your case) will only work on the element it is bound, not helpful for forms validation. Also check for $valid and $invalid as form validation parameter. Also regarding to asynchronous nature, you should use novalidate attribute on form tag to prevent html5 validation.
On Monday, July 4, 2016 at 10:03:45 AM UTC+5:30, Shivendra wrote: > > Below is a sample code - Having Form with ng-click on submit > <div ng-controller="someController"> > <form> > Name: > <input type="text" required ng-model="name"> > > <input type="Submit" ng-click="someFunction(name)"> > </form> > </div> > > Is the handling of ng-click() and "required' html events asynchronous, as > in once a button click happens the ideal way of event execution should be > to check the required fields first and then perform the event bound to > ng-click(), However in my case the it is other way around ? > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
