1
  1. Firstly I create from with initial values.
  2. Then call API to fill the dropdown options.
  3. When page loaded I notice that all dropdown have red border and have ng-dirty class before any edit from UI.

Note: I tried to make form pristine using: makeAsPristine() but nothing change.

<p-dropdown _ngcontent-fxt-c428="" formcontrolname="costCenterId" optionvalue="id" class="p-element p-inputwrapper ng-tns-c200-4 ng-untouched ng-invalid ng-star-inserted ng-dirty">

creation form: enter image description here

Dropdown: enter image description here

call API to fill projectpaymentMethods list: enter image description here

Mouayad_Al
  • 1,086
  • 2
  • 13

1 Answers1

2

I encountered the same issue today and I could only solve it with css magic:

::ng-deep p-dropdown.ng-untouched.ng-invalid.ng-dirty {
  .p-dropdown {
    border-color: #ced4da;
  }
}

I hope this helps.

UmpiH
  • 46
  • 5
  • 2
    I have this issue too, but this is not the way it should be solved. Because it affects on validation and in some cases which it must be red, it is not red because of setting this style. – Jalaleddin Hosseini Sep 19 '22 at 06:38