0
Hello Stack Overflowers!Ember複選框輸入助手不能用戶'on'屬性
鑑於:
{{#each user in model itemController="user"}}
<tr>
....
<td>{{ input type="checkbox" action="acceptChanges" on="click" class="toggle" checked=user.is_disabled }}</td>
然後渲染引發錯誤視圖時:
Uncaught TypeError: string is not a function
然而,去除在 '接通' 屬性,使得加價是:
<td>{{ input type="checkbox" action="acceptChanges" class="toggle" checked=user.is_disabled }}</td>
然後頁面呈現。我的目標是將「acceptChanges」控制器方法綁定到更改此值。 「acceptChanges」是一個ObjectController方法,它只是將對象保存在商店中。
這裏是objectcontroller方法我試圖撥打:
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();
}
},
感謝反引用,安迪 – 2015-02-11 18:41:20
它呈現,它只是不調用該方法。 – RedMage 2015-02-11 18:42:10
我的不好,應該改變,不要點擊。編輯以顯示正確的事件。 – 2015-02-11 18:46:46