I have a problem where my CSS is not taking effect (in Chrome), and I think there is some conflict with Twitter Bootstrap.
input.ng-invalid {
border-color: red;
outline-color: red;
}
My pattern is defined in my controller as:
$scope.hexPattern = /^[0-9A-Fa-f]+$/;
And copying the HTML from the live DOM, I see that both ng-invalid
and ng-invalid-pattern
are set, so my ng-pattern
must be working.
<div class="control-group">
<label class="control-label" for="salt">Salt: </label>
<div class="controls">
<input type="text" id="salt" ng-model="salt" ng-pattern="hexPattern" class="ng-dirty ng-invalid ng-invalid-pattern">
</div>
</div>
I see that in the "Validation states" section of the Forms section of Twitter Bootstrap Base CSS, I see I need to add the error
class to the control-group div.
<div class="control-group error">
Question: How to set the class=error
based on the child input class=ng-invalid
? Can this be done with some soft of ng-class expression? Can I set this via code in the controller? Is there a way to ".$watch" the pattern evaluation like property changes? Any other ideas to get my "red" outline?