Then not working in destroyRecord


#1

I’m using the following code to delete all my itens that have the checked attribute, checked:

delete () {
  let model = this.get('model');

  model.forEach(item => {
    if (item.get('checked')) {
      item.destroyRecord().then((result) => {
        console.log(result);
      });
    }
  });
},

I would like to provide some feedback to the user like “item deleted with success”… but the then is not being called. What could be the problem here?

Thanks.


#2
  1. In your browser’s debugger Network tab, do you see the DELETE request fly out and come back? What status code is in the server’s reply?

  2. If you are using ember inspector (you probably should, it is invaluable when debugging ember apps), it should have a promises section, you could also check there the status of your delete promise.