I'm using PrimeNG and Angular 14. I would like to apply a class (a red border) to my p-dropdown component if the form control contains errors and set another class if it doesn't contain errors. I tried this
<p-dropdown
styleClass="border-round-md"
[ngClass]="{
'border-red-500':
submitted && !this.form.get('myName')?.valid
}"
[options]="cycleFrPerMonth"
formControlName="myName"
></p-dropdown>
but this doesn't work. Even if there are errors, the error class doesn't display. I have even tried replacing the "submitted && !this.form.get('myName')?.valid" with the word "true" but still nothing doing.