ember-cli-todos
ember-cli-todos copied to clipboard
checkbox should abide by actions up / bindings down
is it something like that ? or i misunderstand the "actions up / bindings down" principle.
app/components/todos-route/template.js
{{input type="checkbox" class='toggle-all' checked=allAreDone
action="allAreDoneChange" on="change"}}
app/components/todos-route/component.js
allAreDone: false,
actions: {
allAreDoneChange: function() {
var todos = this.get('active'),
value = this.get('allAreDone');
todos.setEach('isCompleted', value);
todos.invoke('save');
},
patchTodo: function(todo, propertyName, propertyValue) {
todo.set(propertyName, propertyValue);
todo.save();
},
removeTodo: function(todo) {
todo.deleteRecord();
todo.save();
}
}
or i misunderstand the "actions up / bindings down" principle.
nope, you got it!
@stefanpenner is it good for a PR ? checkbox-actions-up-bindings-down
sure, submit the PR i can give feed back easier then :)
@stefanpenner is this looks ok to you? #26