I have an input field and a button in which the user enters the address for geolocation. This is part of a larger form, but I want the validity of this field to be processed when they click the Map button, and not the final submit form. How to set this field as invalid? The call $setValidityresults in an undefined / not function error.
Shape Bit:
<form name="myForm">
<input type="text" name="addy" ng-model="addy">
<a ng-click="geoCode()">Map it!</a>
<span class="error" ng-hide="myForm.addy.$invalid">Bad field</span>
....
</form>
Controller:
$scope.addy = null
$scope.geoCode = function() {
$scope.addy.$setValidity('unique', false);
});
I would also like this field to be checked only once. Therefore, if they enter the address and do not click the "Map" button, it will be checked on sending, but if they click the "Map" button and the field is valid, then it will not work again via the asynchronization function. Suggestions on how best to handle this?