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


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

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

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?


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'},

Leave a Reply

(*) Required, Your email will not be published