Topic: Object as mdb-option [value]

bitmads premium asked 5 years ago


Expected behavior

I would like to add objects (not strings) as [value] parameter of mdb-option, BUT show other some property of the selected object in the autocomplete field.

I'm looking for something like displayWith in angular-material autocomplete:https://material.angular.io/components/autocomplete/overview

Actual behavior

When I use object as mdb-option value, I'm getting [object Object] in the completer input field.

I tried (select) and override the input, but sometimes the internal select function runs slower and finally I've got [object Object] back.

Resources (screenshots, code snippets etc.)

I wanted to insert a code but this thing can't format it :(


pzimmer priority answered 3 years ago


I have this issue as well. There is a [displayValue]="onDisplayValue" attribute that allows you to have a function (onDisplayValue) that will take the option and return the string to display, but the angular does not compile when you have an object for the value.


Arkadiusz Idzikowski staff answered 5 years ago


Unfortunately we don't have any feature similar to displayWith in current version. I agree that this is must have for this component. I already created task with high priority for that.


bitmads premium answered 5 years ago


I'm a premium user and nobody picks up my support request? What's going on?



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: Premium
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: 8.1.1
  • Device: PC
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: Yes
  • Provided link: Yes