I am following along Embers' getting started guide and have a question regarding this step of the "getting started guide": http://emberjs.com/guides/getting-started/marking-a-model-as-complete-incomplete/
In short, we should toggle a boolean property of a model by checking/unchecking a checkbox.
Here is the code in JSBin: http://jsbin.com/UDoPajA/1/edit
I implemented the UI code:
{{input type="checkbox" class="toggle" checked=isCompleted}}
And it seems like everything is working as it should. The UI is updated correctly and Ember inspector tells me the property is being toggled on the model.
The guide also tells me to add a controller as follows:
Todos.TodoController = Ember.ObjectController.extend({
isCompleted: function(key, value){
var model = this.get('model');
if (value === undefined) {
// property being used as a getter
return model.get('isCompleted');
} else {
// property being used as a setter
model.set('isCompleted', value);
model.save();
return value;
}
}.property('model.isCompleted')
});
Is the TodoController as defined in the guide (same step) redundant at this point? If not, what does it add?