I am seeking to find a clean solution to the following antipattern with my AngularJs app:
I have two forms (located in two different templates/partials as of now) which are completely identical but for the ng-submit attributes which point to different Angular controller methods.
First form:
<form ng-submit="saveTraining()" method="post" class="form-horizontal">
<div ng-hide="trainingInfo.statusOK" class="alert alert-danger form-group">
<ul>
<li ng-repeat="error in trainingInfo.errors">{{error.message}}</li>
</ul>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="description">descr</label>
<div class="controls col-lg-6">
<textarea rows="5" cols="50" id="description" ng-model="trainingInfo.training.description" class="form-control"></textarea>
</div>
</div>
...
Second form is identical but for the ng-submit attribute which is as follows: ng-submit="editTraining()"
I would be very grateful if someone who has met the same issue with AngularJs forms could suggest a best practice to me...