Topic: mdb-checkbox with id fails
Expected behavior
Checkbox should toggle
Actual behavior
Adding id="whatever"
to an mdb-checkbox
prevents toggling
Resources (screenshots, code snippets etc.)
Arkadiusz Idzikowski staff answered 5 years ago
In this case you should use this version:
<mdb-checkbox [id]="'whatever'">Checkbox</mdb-checkbox>
We need to take the value from id
input and use it as an attribute of the internal input element. If you add id
without the []
, then it will be added directly to the mdb-checkbox
element.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: 9.2.0
- Device: NA
- Browser: NA
- OS: NA
- Provided sample code: No
- Provided link: No
Arkadiusz Idzikowski staff commented 5 years ago
Thank you, we will take a closer look at that. Please try this code, it should work correctly when you add input binding:
<mdb-checkbox [id]="'whatever'">Checkbox</mdb-checkbox>
itay pro commented 5 years ago
Works Please update