P-dropdown initial value not set inside custom component.

UI Components for Angular
Post Reply
jonnyknowsbest
Posts: 3
Joined: 03 Feb 2020, 10:49

07 Feb 2020, 15:10

I have created a custom component containing a p-dropdown, that implements the ControlValueAccessor interface so I can use it on a reactive form by passing in the formControlName like so:

Code: Select all

<my-component options="options" optionLabel="description" formControlName="priority"></my-component>
Although changing the value in the dropdown causes the correct value to propagate up from the custom component to the form, the initial value in the drop down is not set and instead it just shows the first value in the list.

What property do i need to set on the p-dropdown to set the initial value?

jonnyknowsbest
Posts: 3
Joined: 03 Feb 2020, 10:49

10 Feb 2020, 10:29

So is there no built-in way to set the initial value of a drop-down when it is inside a custom component on a reactive form without using ngModel?

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests