javascript - Binding checked checkboxes to array attribute in Ember.js -
i have form input fields , checkboxes. route looks this:
sharedcontentnewroute = ember.route.extend setupcontroller: (controller) -> content = @modelfor("content") controller.set('content', @store.createrecord('shared_content')) controller.set('handles', @store.find("handle"))
shared_content model has, among other attributes, handle_ids array attribute needs populated ids of checked checkboxes. template populating checkboxes (available handles) defined within shared_content/new template:
... {{#each handles}} <div class="checkbox"> {{input type="checkbox" id=id}} <label {{bind-attr for="id"}}>{{data.name}}</label> </div> {{/each}} ...
the problem need checked checkboxes ids , put them handle_ids attribute of shared_content model (which model template) before model gets saved. there nice solution kind of binding?
take @ this
http://emberjs.com/guides/getting-started/show-when-all-todos-are-complete/ http://emberjs.com/guides/getting-started/toggle-todo-editing-state/
this can you, when checkbox checked can execute function when check checkbox, can create object on controller/router , save checkbox info there
Comments
Post a Comment