I have been given a task by my boss who still likes things the old way... have a HTML page/view and submitting a form to a PHP page server side. We have introduced AngularJS to his app and he has the following code in his page:
<form name="rForm" id="rForm" action="demo_form.php" method="post">
<input type="hidden" name="quantity" id="reservationQuantity" ng-value="selectedQuantity"/>
<input type="hidden" name="date" id="reservationDate" ng-value="selectedDate"/>
<input type="hidden" name="time" id="reservationTime" ng-value="selectedTime"/>
<input type="hidden" name="mId" id="mID" value="{{ $merchant->id }}" ng-value="mId"/>
</form>
<button>Go to next page...</button>
Now he wishes for us to have a link or button to submit this form which is outside the form, I believe that we should control all of this is a controller with all post functionality being handled by an injected / separate $http
service. He doesn't believe me and says he knows best and I should just handle submitting the form like so
<button onclick="$('#reservationForm').submit();">Go to next page...</button>
I don't like this... however he pays the wages. Is there some way I can submit the form/page from my Angular controller and remove all that horrible jQuery code? Something like this (this won't work, I am just using this for visual purposes)
<button ng-click="ng-submit()">Go to next page...</button>
... and am I right saying that his method is bad practice and if we are going to submit to the server by pushing the page there's no point in us using an MVC framework.