简体   繁体   中英

Emberjs: deleteRecord() doesn't update model consistently

(To Repro: Click into a list, add a task, try to remove that task.)

I have an app where I can create multiple lists of tasks, each task can be commented on.

I am having trouble getting consistent behavior when deleting a record. I can delete a record within an already existing model. However once I create a Record, I can't seem to delete it. But then once I leave a page (transition to another Route) and come back, I can delete again. Is this a problem with .save()?

JSBin: http://jsbin.com/oDOsoqA/3/edit

It's the {async : true} on the hasMany tasks. Honestly this functionality is a little shaky (My guess is that it should be nailed down and functionality will be a bit more apparent once they've hit a solid 1.0).

You can get rid of the push and change the links to the model and it all works, but I'm not sure about your async necessities.

http://jsbin.com/oDOsoqA/4/edit

addTask : function(){
  var foo = this.store.createRecord('task', { 
    description : '',
    list : this.get('model'),
    comments : []  
  });
  //this.get('tasks').pushObject(foo);
  foo.save();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM