When I try to modify the style of an i
tag based on the touched
and invalid
state of another field, only the input
tag's style changes and not the i
tag. Here's the CSS code I'm using:
input.ng-touched.ng-invalid
{
border-color: red;
}
input.ng-valid
{
border-color: green ;
}
.green-icon
{
color:green;
}
.red-icon
{
color:red;
}
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text bg-white">
<i class="fas fa-user circle" [class.green-icon]="CardOwnerName.valid" [class.red-icon]="CardOwnerName.invalid && CardOwnerName.touched"></i>
</div>
</div>
<input #CardOwnerName formControlName="CardOwnerName" name="CardOwnerName" class="form-control" placeholder="Card Owner Name" required>
</div>
</div>
It seems like my Angular version may be causing an issue. Could it be that something has been deprecated?