vitalets / checklist-model

AngularJS directive for list of checkboxes
http://vitalets.github.io/checklist-model
MIT License
1.05k stars 207 forks source link

Any chance to preselect boxes when model is already filled? #100

Closed lennarterikson closed 9 years ago

lennarterikson commented 9 years ago

First of all thank you for sharing your amazing checklist-model, I was searching for a solution like this for days! My question is: Is there is any chance to select the checkboxes when the underlying model changes? For example: I receive a list of booked rooms from my REST-API and set it to be my selectedRooms model. I would like the checkboxes of the corresponding rows in my room table to be selected. However even if the underlying model changed, the checkboxes didn't turn into checked-mode.

Do you have any idea how to solve this? Is there a parameter I forgot to add? Or is this behaviour not intended?

beradrian commented 9 years ago

Actually this is the intended behavior. I don't know your code, but I suspect that you need to call something like scope.$apply().

beradrian commented 9 years ago

I suspect that you managed to fix it, so I will close it. If you still have problems, please feel free to re-open it.