select the first item in dropdown when there is only one item, and disable the dropdown primeng

Discussão em 'Angular' iniciado por sticky_elbows, Novembro 25, 2024.

  1. If I have the following dropdown, how can I select the first item if there is only 1 element in the filteredGroupNames then disable the dropdown and don't display the placeholder

    <ng-template pTemplate="content">
    <div class="field">
    <label>Name</label>
    <p-dropdown [(ngModel)]="newOrSelectedGroupName" [options]="filteredGroupNames" [showClear]="true"
    placeholder="Select a group"

    ></p-dropdown>
    </div>
    </ng-template>

    Continue reading...

Compartilhe esta Página