How can I make ng-select disabled? I tried [disabled] property, but it does not work here. Also tried to make it disabled using form control, but nothing works.
Stackblitz example
You can disable/enable a form control when you initialize it by setting disabled
to true
creds.push(this.fb.group({
fruitType: this.fb.control({value: 'Apple', disabled: true})
}));
To disable/enable the control later dynamically in your component. You can do so by calling the disable/enable methods for that particular form control.
// To enable form control
fruitType.enable();
// To disable form control
fruitType.disable();
If you are looking to disable ng-select in html using any dynamic condition then you can use [readonly]
property.
<ng-select
formControlName="myControl"
[readonly]="condition_resolving_to_true_or_false"
</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