[FIXED] PrimeNg p-dropdown Does not Display Array Values

Issue

I have component using PrimeNg p-dropdown.
html code:

<p-dropdown [style]="{'width':'150px'}" [options]="portNames" placeholder="Select a Port">
</p-dropdown>

ts portNames decleration:

portNames: string[] =["Port 01","Port 02", "Port 03"];

My Problem is that DropDown Does not Display Values “Port 01″,”Port 02”, “Port 03”.

Maybe I have any mistake?

Solution

Try adding your dropdown values in label and values

portNames =[
{label:'Port 01', value:'Port 01'},
{label:'Port 02', value:'Port 02'},
{label:'Port 03', value:'Port 03'},
];

Answered By – Mancy Saxena

Answer Checked By – David Marino (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published