This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Description
I have the following input with validation. I cannot get the formError to show up when the input is in an invalid state. The class is being applied to the input however not to the model.
<div class="form-group" ng-class="{'has-error': myObj.ssn.$invalid}">
<label for="ssn" class="field-label">SSN:</label>
<div class="field-value">
<input type="text" name="ssn" id="ssn" class="form-control" ng-model="myObj.ssn" ng-pattern='/^\d{3}-?\d{2}-?\d{4}$/'>
<div class="formError" ng-show="myObj.ssn.$invalid">Please enter a valid ssn.</div>
</div>
</div>
HTML after editing the text in the input to be invalid.
<div class="form-group" ng-class="{'has-error': myObj.ssn.$invalid}">
<label for="ssn" class="field-label">SSN:</label>
<div class="field-value">
<input type="text" name="ssn" id="ssn" class="form-control ng-untouched ng-dirty ng-invalid ng-invalid-pattern" ng-model="myObj.ssn" ng-pattern="/^\d{3}-?\d{2}-?\d{4}$/">
<div class="formError ng-hide" ng-show="myObj.ssn.$invalid">Please enter a valid ssn.</div>
</div>
</div>