<div class="form-group" ng-class="{'has-error': claimForm.consigneeID.$invalid && claimForm.consigneeID.$touched}">
<label class="label-bold">Consignee ID</label><br>
<input name="consigneeID" ng-model="coId" type="number" ng-maxlength="5" ng-minlength="5" class="form-control input-sm" required>
<div class="help-block" ng-messages="claimForm.consigneeID.$error" role="alert">
<div ng-message="required">Field is required.</div>
<div ng-message="minlength">Too few digits.</div>
<div ng-message="maxlength">Over 5 digits.</div>
</div>
The minlength and maxlength errors show the correct messages and correctly set the "has-error" ng-class. However, if I add "required" to my field and the corresponding message, upon reload the "Field is required" appears always (until filled in).
The red "has error" class does not appear, though, unless a different error is tripped.
What did I miss here?