How to static add options for PrimeNG p-dropdown

Discussão em 'Angular' iniciado por tuongduy, Abril 19, 2025.

  1. tuongduy

    tuongduy Guest

    I would like to static add options for p-dropdown.

    <p-dropdown [(ngModel)]="selectedOption"
    placeholder="Select options" optionLabel="name"
    (onChange)="onChangeOption()">
    <option *ngFor="let item of items;" [value]="item.value">{{item.label}}</option>
    <option value="null">Others</option>
    </p-dropdown>


    I have tried to dynamic add the "Others" option at ts file, but I still want to static add like this Is there any better way to do this ? Tks you all

    Continue reading...

Compartilhe esta Página