mdb-select options with object


Topic: mdb-select options with object

chawinping asked 5 years ago

Hi

I read a doc of Angular Select and i see that the "optionsSelect" have to be Array of

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

but when i get data from my backend. it's in difference form like

[{ num: 1 , name: 'dog', color: 'red ' }, { num: 2 , name: 'cat', color: 'blue' } ]

so I have to loop and push my data to Array of { value: '1', label: 'dog' }.

Is there anyway to use my data without tranform to "{ value: '1', label: 'Option 1' }"? or anyway to use without loop thourght all of my object array?


Hope you understand my English.Thanks


cloed just know how to use map. my bad.


FREE CONSULTATION

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

Status

Closed

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 8.5.0
  • Device: PC
  • Browser: Chrome
  • OS: Win10
  • Provided sample code: No
  • Provided link: No