How to initially set a value in ng-select?

Discussão em 'Angular' iniciado por Sanjana, Fevereiro 15, 2025.

  1. Sanjana

    Sanjana Guest

    I have ng-select with list of values. If i click on selected value and click clear , need to set first option .Please help me how to sort it out . https://stackblitz.com/edit/ng-select-wdcg5a?file=app/app.component.ts

    <ng-select class="" [items]="assigneeStatus" name="status_filter_id"
    bindLabel="lookup_label" bindValue="com_lookup_id" placeholder="Assignee Status"
    [(ngModel)]="searchAssigneeObj.status_filter_id" [hideSelected]="true"
    #status_filter_id="ngModel">
    <ng-template ng-label-tmp let-item="item">
    <span>{{item.lookup_label || 'All'}}</span>
    </ng-template>
    <ng-template ng-option-tmp let-item="item" let-search="searchTerm"
    let-index="index">
    <span>{{item.lookup_label || ''}}</span>
    </ng-template>
    </ng-select>

    Continue reading...

Compartilhe esta Página