Enable/disable ion-select programmatically

How I can disable or enable a ion-select control programmatically?

I’ have this piece of code in my html.
> <ion-select [(ngModel)]=“myvalue” cancelText=“Cancel” okText=“Okay!” disabled=true
> <ion-option *ngFor=“let obj of arrayobj” [value]=“obj.id”>{{obj.name}}
> </ion-select>

This work, but how I can bind “disabled” attribute and check its value from .ts file?
Based to another value I’d like to enable/disable the combobox.
I tried [disabled] =“myBooleanInTs” , where myBooleanInTs is a boolean value defined in my .ts page,but it doesn’t work.

you can set it as disabled ="{{isEnabled}}" can you can toggle isEnabled in your ts file.

1 Like

Thank you. It works!

1 Like

Revive an old topic, but you can now use [disabled]=“disableVariable”

You can, but it’ll show an Angular warning if using reactive forms (at browser’s console). Consider this:

get status_id() {
  return this.historyForm.get('status_id') as FormControl

And then:

// or

This way you’ll avoid angular’s warning.