vitalets / checklist-model

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

Check boxes not checked. do not match model #126

Closed redcricket closed 8 years ago

redcricket commented 8 years ago

Hi, Sorry to bother you again. I think I have two plunkers that explain what I think is a problem.

The first plunker demonstrates that I can submit whole JSON objects in my formdata:

http://embed.plnkr.co/wd87StROz8Yi5dUq3Nt1/

If you could please try this plunker out by filling out some form data and clicking the add button. AN alert popup will appear displaying the formdata I would send to my REST API.

The second plunker (http://plnkr.co/edit/8CJ3Xh?p=preview) is the one you saw before in my SO question: http://stackoverflow.com/questions/34914941/how-to-get-checkboxes-to-initialize-based-on-model

The problem I am having is that if I click on the Edit button (near the bottom of the page) for the "Examples'R US" vendor, the appropriate product check boxes do not become checked. I was hoping that the "Plugs" and "Back Scratcher" check boxes would be checked.

Thanks

beradrian commented 8 years ago

I don't understand what is the question related to the first plunker.

Regarding the second one, what made you hope that the checkboxes will change. in the edit_record scope method you just modify a local variable data and that's it. You should modify a scope variable that points to the one reference in ng-repeat (to show/hide checkboxes) or by checklist-model (to check/uncheck).