I have a simple reactive form like this:
this.loginForm = this._fb.group({
email: ['', [Validators.required, Validators.pattern('^[A-Za-z0-9._%+-][email protected]$')]],
password: ['', Validators.required]
});
The on HTML:
<!------------------------- PASSWORD FIELD ------------------------->
<div class="uk-margin">
<input type="password" class="uk-input"
placeholder="Enter Password" formControlName="password">
<!----- VALIDATION WARNINGS ----->
<div *ngIf="loginForm.get('password').touched">
<div *ngIf="loginForm.get('password').hasError('required')">
<div class="uk-text-danger"> Password is required.</div>
</div>
</div>
</div>
Then in CSS:
.ng-valid[required] {
border: 5px solid #42A948;
}
.ng-invalid[required] {
border: 5px solid red;
}
The ng-valid/invalid CSS is being applied. I want to change the colour of the input fields border. But the CSS does not work form me. What am I doing wrong?
Update:

The ng-valid/invalid CSS is being applied - But the CSS does not work for meI'm getting mixed signals here, is it being applied or not?valid/invalidcode in css but its not taking effect. I hope that makes sense.ng-validorng-invalidanywhere in the HTML markupinspect-elementI can see theng-valid, ng-touchetc classes added into the HTML. Please see my updated question..ng-valid[required]or.ng-invalid[required].