I have the following code:
<form class="form"
data-ng-submit="modalSubmit(modal.data)"
id="modal-body"
name="modalForm"
novalidate>
This works, and when I press a submit button, the modalSubmit function is called.
However, I would like to do this in my controller:
$scope.modalForm.$setPristine();
But this leads to an error:
has no method '$setPristine'
How can I set a form intact? I tried to add data-ng-form="modalForm", but then a message talking about the effect of duplicate directive names.
I tried changing the form element to DIV, but then clicking on the submit button does not call the function
Here is an example (modified from another user) that shows what I'm trying to do, which is set for the values intact:
plnkr.co/edit/LNanJdAggMLIgxii0cfv?p=preview
source
share