Topic: mdb-checkbox with id fails
itay
pro
asked 4 years ago
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 4 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
- ForumUser: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: 9.2.0
- Device: NA
- Browser: NA
- OS: NA
- Provided sample code: Yes
- Provided link: No
Arkadiusz Idzikowski staff commented 4 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 4 years ago
Works Please update