I am attempting to style an input field with a FormControl using the :invalid pseudo-class. Here is my code snippet:
scss
input:invalid {
background-color: red;
}
html
<input type="text" [formControl]="NameCtrl">
Unfortunately, this styling is not working as expected. However, when I use the required attribute, it works fine:
input:invalid {
background-color: red;
}
<input type="text" required>
If anyone has any suggestions, solutions, or workarounds on how to properly style an input field with error styles using FormControl, I would greatly appreciate it. Thank you!