Clearing Checkbox UI based on a criteria

Hi ,

I am using binding like the below to list checkboxes aganist a list f users; i have a use case of allowing max 5 checkboxes to be clicked and clicking on the 6th one shows a error saying ‘max 5 supported’; after the error I need to uncheck the presently clicked box .I am unable to do it by setting value of ‘checked’ to ‘false’ for the corresponding Ember object. Any help?.

<input type=‘checkbox’ checked={{checked}} value={{value}} onchange={{action (mut checked) value=‘target.checked’}} />

I think that every checkbox should be a separate component with own state (flag isChecked). Control logic should be placed inside controller.

e.g. of pseudo-code: user.hbs → loop checkboxes: <Checkbox…/> end of loop

UserController.js control logic: checkMethod(checkboxFromTemplate) { if (checked > 5) checkobxFromTemplate.uncheck() else checkboxFromTemplate.check(); }