我已创建此jsbin来说明问题。如果您采取以下步骤:
该按钮调用此动作处理程序:
deleteAll: function(){
//delete records happens here
var self = this,
companiesController = this.controllerFor('companies');
Ember.run(function(){
self.controller.forEach(function(company){
company.deleteRecord();
company.save().then(function(c){
//companiesController.removeObject(c);
});
});
});
}
删除记录时不应该从companiesController的模型中删除记录,或者如何从数组中删除该记录?
在公司设置的公司控制器模型如下:
App.CompaniesRoute = Ember.Route.extend({
model: function(params, transition){
return this.get('store').find('company', {sector: params.sector});
},