I am currently using PrimeNG and Angular 14. My goal is to add a red border class to my p-dropdown component when there are errors in the form control, and apply another class if there are no errors. I attempted the following:
<p-dropdown
styleClass="border-round-md"
[ngClass]="{
'border-red-500':
submitted && !this.form.get('myName')?.valid
}"
[options]="cycleFrPerMonth"
formControlName="myName"
></p-dropdown>
Unfortunately, this approach didn't work as expected. The error class doesn't appear even when there are errors present. I also tried replacing the condition with the word "true", but that didn't solve the issue either.