Hello Stack Overflowers!
Given:
{{#each user in model itemController="user"}}
<tr>
....
<td>{{ input type="checkbox" action="acceptChanges" on="click" class="toggle" checked=user.is_disabled }}</td>
Then when rendering the view an error is thrown:
Uncaught TypeError: string is not a function
However, removing the 'on' property, such that the mark-up is:
<td>{{ input type="checkbox" action="acceptChanges" class="toggle" checked=user.is_disabled }}</td>
Then the page renders. My goal is to bind the "acceptChanges" controller method to changing this value. "acceptChanges" is an ObjectController method that simply saves the object in the store.
Here is the objectcontroller method I am trying to call:
AdminApp.UserController = Ember.ObjectController.extend({
actions: {
editUser: function(){
this.set('isEditing', true);
},
acceptChanges: function(){
console.log("accepting changes");
this.set('isEditing', false);
var model = this.get('model');
model.save();
}
},