EmberJS错误从模型中删除记录

时间:2016-07-07 09:53:02

标签: ember.js ember-data

当我从数据库中删除某个项目时,出现以下错误

Attempted to handle event `pushedData` on <app@model:mymodel::ember851:myid> while in state root.deleted.inFlight.

但有时错误会改为:

Error: Attempted to handle event `notFound` on <app@model:mymodel::ember851:myid> while in state root.deleted.saved. 

我的模特是:

export default Model.extend({
    position: attr('number'),
    name: attr('string'),
    shared: attr('boolean', { defaultValue: false }),
    color: attr(),
    textColor: attr(),
    permissions: attr(),
    calendarstack: belongsTo('calendarstack'),
    event: hasMany('event'),
    isActive: attr()
});

我删除记录的代码:

delete: function(type, id){
  var that = this;
  this.store.findRecord(type, id).then(function(data) {
    data.deleteRecord();
    data.save();
  });
}

0 个答案:

没有答案