I want to submit multiple forms from different controllers but I'm not sure how. The reason for this is because I have a save button on multiple different tabs of my webpage. By clicking save I want to submit the form and then validate it. I want to submit my forms from main controller and I don't know how to refer to the forms.
This is my form
<form name="vm.driverForm" novalidate>
<formly-form class="top20" model="vm.model" fields="vm.fields" options="vm.options" form="vm.driverForm"></formly-form>
</form>
and submit function in my main controller
vm.onSubmit = onSubmit;
function onSubmit() {
$scope.vm.driverForm.$setSubmitted(); //THIS IS THE PART I'M TRYING TO FIGURE OUT
}
and the button in the main controller
<button type="button" ng-click="vm.onSubmit()" class="btn btn-primary submit-button top5">Save Driver</button>
I don't want to copy and paste my submit function and save button code into every single controller that uses the button.