I am trying to remove the validation message without entering any data. whenever I used the password and confirm the password there always an active error message. When I fill in the correct password then error messages are removed but the initial time is the active error message.
<form name="myForm2" class="row gap-y input-round ng-pristine ng-scope ng-invalid ng-invalid-required ng-valid-pattern ng-invalid-compare-to"
data-ng-if="otpVerificationDone==true">
<div class="col-12 mx-auto">
<div class="form-group" data-ng-hide="passwordField">
<input type="password" class="form-control ng-pristine ng-empty ng-invalid ng-invalid-required ng-valid-pattern ng-touched"
name="newpassword" data-ng-model="userform.newpassword"
id="newpassword" placeholder="Password"
data-ng-pattern="/^(?=.*[A-Z])(?=.*d)(?=.*[$@$!%*#?&])[A-Za-zd$@$!%*#?&]{8,20}$/"
required="" aria-autocomplete="list">
<span class="text-warning small-5">
<span class="text-danger small-5 ng-hide"
data-ng-show="myForm2.newpassword.$error.pattern">
Password must contain 8 characters, including Special/UPPER/lowercase and numbers.</span>
</span>
</div>
<div class="form-group" data-ng-hide="passwordField">
<input type="password" class="form-control ng-pristine ng-untouched ng-isolate-scope
ng-empty ng-invalid ng-invalid-required
ng-invalid-compare-to" name="confirmpassword"
data-ng-model="userform.confirmpassword" id="confirmpassword"
placeholder="Password" data-compare-to="userform.newpassword"
required="">
<span class="text-danger small-3">
<span class="text-danger small-3" data-ng-show="myForm2.confirmpassword.$error.compareTo">Passwords do not match.</span>
</span>
</div>
<button type="button" data-ng-hide="passwordField" class="btn btn-round btn-success" data-ng-disabled="myForm2.$invalid" data-ng-click="resetPassword()" disabled="disabled">Submit</button>
</div>
</form>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…