I have an input field:
<input name="fName" type="text" class="form-control dude.firstName"
ng-trim="false"
ng-pattern="patterns.name"
ng-model="dude.firstName"
ng-model-options="{ updateOn: 'blur' }"
required>
<span class="error" ng-show="idForm.fName.$error.pattern">
Please only use letters, forward slashes, and hyphens
</span>
My requirements are this:
- If user has not changed anything, it needs to run saveIdentification
- If user has changed something and it is not valid, then stop and allow the form to display the message
If the user has changed something and it is valid, then run saveIdentification
<span ng-show="localEditing.id=='SAVE'" tabindex="0" title="Save Changes" class="globalIcon-save action-edit-button" ng-click="(idForm.$pristine || (idForm.$dirty && idForm.$valid)) && saveIdentification()"> </span>
The solution above fulfills requirements 1 and 2 but not 3. It will not save if the form is changed and valid.