Topic: Material Select Does Not Support “disabled: false”

rctoone pro asked 7 years ago


Why doesn't your material select option allow setting disabled options programmatically like the following:

this.disOptionsSelect = [
{ value: '1', label: 'not disabled option 1', disabled: false},
];

Instead I have to do the following by not including the "disabled" field. 
{ value: '1', label: 'not disabled option 1'}

Since you support setting disabled to true. I would expect you can also set it to false as to be able to set the field dynamically with an object. Not allowing this makes the use of the object completely useless...


Dawid Adach pro answered 7 years ago


Dear rctoone , actually, our material select allows that :) please try following code:

.html:

<div class="row">
<divclass="col-md-6">
<mdb-select [options]="optionsSelect"placeholder="Choose your option"></mdb-select>
<label>Example label</label>
</div>
</div>

.ts:

export class AppComponent implements OnInit {
optionsSelect:Array<any>;
ngOnInit() {
this.optionsSelect= [
{value: '0', label: 'Aech'},
{value: '1', label: 'Art3mis', disabled: true},
{value: '2', label: 'Daito'},
{value: '3', label: 'Parzival'},
{value: '4', label: 'Shoto', disabled: true}
];
}
}

rctoone pro commented 7 years ago

Actually it doesn't. the code you pasted in from the example has disabled set to true. As the questioned stated, try setting it to false and see what happens (it will still be disabled).


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags