Reputation: 3657
I've made my own form directive <if-form form="vm.form" submit="vm.sendForm()"><if-fields></if-fields></if-form>
In that directive I have regular form <form name="vm.form">....</form>
In vm.form
I have ngFormController (with $invalid, $dirty, $error and so on).
I want to submit form from outside <if-form>
.
How can I submit form using vm.form
? I want it to pass all validation. Is it possible?
Upvotes: 1
Views: 201
Reputation: 594
You can use ng-click to call your submit function from anywhere:
ng-click="vm.sendForm()"
or you can associate the separate submit button using form=""
<input type="submit" value="Submit" form="vmForm">
Upvotes: 2