-
Scenery:
I have a form with 3 steps, a jsp for each step. In a given jsp there is a input
text
with the directiveng-minlength
and aonChange
that calls a function that validates with$setValidity
if the value entered is invalid. -
Problem:
When the field is invalid and navigation between the steps occurs, returning to step the field loses the status of invalid. As a workaround, I tried to validate the field when loading the page but there is an error executing the code below because the form has not yet been loaded:
$scope.form.numeroCartao.$setValidity("valid", true);
-
Question:
How to validate a field with
$setValidity
when loading page?