>>>So, this worked wonderfully for the pattern validations, but the form originally still came with the password fields with red borders (the required). Is it expected and I should be contend with that behavior?
>>>
>>>Thanks again.
>>
>>You are using 'required' (html validation).. Maybe 'ng-required' ?
>
>>>>Yes, will re-try. I thought about it.
>
>>>>UPDATE. Changed required to ng-required="true" but got the same red underline. I think it's fine.
>
>Maybe you can inspect the element in developer tool to figure out the model state (ng-pristine, ng-valid, ng-invalid, ...) on the password iput element, then the CSS class transitions can be useful to apply desired visual effect depending on the state, this can be a workaround.
>.pure-form input.ng-pristine.ng-invalid { // desired style }
Here is what I see when I inspect the element:
<input class="form-control ng-pristine ng-empty ng-invalid ng-invalid-required ng-valid-pattern ng-touched"
ng-model="newPassword" name="newPassword" placeholder="New password" type="password" autocomplete="off"
ng-required="true" ng-model-options="{ updateOn: 'blur' }" ng-pattern="/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/" required="required">
What is .pure-form ?
I think I am good as is right now. I'll leave it at that.
Thanks again for your help.
So, even though I don't have required attribute on the control, ng-required automatically translated into required.
If it's not broken, fix it until it is.
My Blog