0
,當我嘗試使用我在我的控制器已經定義了一個「拯救」行動,我收到此錯誤Ember.js接受「遺漏的類型錯誤」行動在控制器
Uncaught TypeError: Object [object Object] has no method 'save'
。
這裏是我的HTML代碼
<tbody>
{{#each}}
<tr class="people-list">
<td>
<div class="category-text">
{{input type="text" class="quick-add-element" action="save" valueBinding=Name}}
{{#linkTo 'category' this}}
{{Name}}
{{/linkTo}}
</div>
</td>
</tr>
{{/each}}
</tbody>
這裏是我的類別控制器
actions: {
save: function(){
var category = this.get('model');
// this will tell Ember-Data to save/persist the new record
category.save();
// then transition to the current user
this.transitionToRoute('category', category);
}
}
和我的類別控制器
actions: {
save: function(){
var category = this.get('model');
// this will tell Ember-Data to save/persist the new record
category.save();
// then transition to the current user
this.transitionToRoute('category', category);
}
}
我的類別路由
VpcYeoman.CategoryRoute = Ember.Route.extend({
serialize: function(model){
return {category_id: model.get('id')};
},
});
什麼模板是HTML代碼? – chopper
很難從代碼片斷中進行調試。如果你能爲我們製作一個jsBin,那將會容易得多。 – chopper