jonsamwell/angular-auto-validate

Is it possible to have a ngSubmit equivalent on a ngForm, having the same behaviour as with a regular form ?

Closed this issue · 2 comments

Hi there,

I wonder if there's way to have the same behaviour of a ng-submit = "someFunction()" on a regular < form > but with a ngForm ? Which is having a button submitting a form (calling someFunction) ONLY if the form is valid??

It works great with a regular form tag with a ng-submit directive, but this doesn't seem to be the case with a ngForm.. The docs dont seem to exclude this use case apparently :
https://docs.angularjs.org/api/ng/directive/form
see section "Submitting a form and preventing the default action"

Am I wrong ? Thanks a lot

I don't see any reason why it wouldn't work if you put the ng-sumbit directive in a ng-form tag?

...

Did you try putting the ng-submit directive on the ngForm tag?