Topic: mdb-select options others than "value" and "label"

zoloterra free asked 5 years ago


Hello,

In all code samples to the mdb-select component, the options are set as the following:

this.optionsSelect = [

  { value: '1', label: 'Option 1' },

  { value: '2', label: 'Option 2' },

  { value: '3', label: 'Option 3' },

];

So once I have an array of objects with id and name properties I have to convert it to an array of objects with the properties value and label, what I would prefer not to.

The question: is there any way to configure the mdb-select component so it uses my id property for the value and the name property for the label?


Arkadiusz Idzikowski staff answered 5 years ago


Hello,

It's not possible in the current version. For now you need to convert your objects so they have value and label properties.



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.5.0
  • Device: Any
  • Browser: Any
  • OS: Any
  • Provided sample code: Yes
  • Provided link: No