angularangular-ngselect

disable angular ng-select window


We are using ng-select in a project and I'm facing the problem that I can't disable the ng-select window. Is it possible to disable it with native code or do I need to find some custom solution?

  <ng-select 
    #changeowner
    class="custom-owner"
    [placeholder]="leagueOwner.full_name"
    [clearSearchOnAdd]="true"
    (change)="changeLeagueOwner($event)"
    [clearable]="false"
    [virtualScroll]="true"
    [items]="adminLeagueMembers"
    (scrollToEnd)="onAdminLoadScrollEnd()"
    bindLabel="full_name">
</ng-select>

Solution

  • As stated in other responses you can use the option

    [disabled]="booleanValue"
    

    However you will need a formControlName value set as well as described here.

    You would get:

    <!-- test-component.html -->
    <ng-select [disabled]="myDisabledCondition" formControlName="myFormControl" 
    ...>
    </ng-select>