Topic: mdb-select - Two-way binding using a numeric value

peter.r.bladh@saabgroup.com free asked 5 years ago


It seems that the component mdb-select does not support two-way binding when using a numeric variable. In such a case no value is selected in the options list. If I change the variable to a string the behaviour is correct.

Any plans to change this behavior?



But isn't this more like a bug?

If "selectedValue" is a numeric parameter (for example 3) and the option value is '3', no option is selected.

<mdb-select [(ngModel)]="selectedValue" [options]="selectOptions" label="Media Type" ></mdb-select>

Arkadiusz Idzikowski staff commented 5 years ago

The option object accepts only strings, so in order to display option label you need to pass string to the ngModel as well. In this case it is expected behavior.


Arkadiusz Idzikowski staff answered 5 years ago


We have plans to change the way of adding options to the component in the future, but unfortunately I can't provide any ETA yet.



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