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>
If you are using the Angular reactive form and trying to disable the ng-select using the following code then sorry it will not work in some case. If you are using formControlName then it will not work but work in [(ngModel)] case. The best way to do this is by using reactive form control.
The best way to do this is by using reactive form control. [readonly] boolean false no Set ng-select as readonly. Mostly used with reactive forms. adding [disabled]="true" did not work for me But setting [readOnly] to true did.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With