Topic: mdb-select-2 multiple=true error selectValue.forEach is not a function
ASOKUMAR IT free asked 2 years ago
Expected behavior Using mdb-select-2 with multiple=true throws this error: Uncaught (in promise): TypeError: selectValue.forEach is not a function With multiple=true set the application is working fine.. the error is logged in the console. Works fine with multiple=false. Actual behavior
Resources (screenshots, code snippets etc.)
Arkadiusz Idzikowski staff answered 2 years ago
The problem is in the formControl
default value. You added an empty string but the component expects an array of values. In this case, if you don't want any default value, just leave the formControl
empty or use null
or empty array.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB Angular
- MDB Version: MDB4 13.0.0
- Device: Desktop
- Browser: Firefox
- OS: Windows 10
- Provided sample code: No
- Provided link: No
Arkadiusz Idzikowski staff commented 2 years ago
When exactly does this error occur? Could you please edit your post and provide HTML/TS code you use to render the component and more information about reproduction steps?
ASOKUMAR IT free commented 2 years ago
ts file code:
html: