samedi 11 février 2017

Ember - destroyRecord is not a function on model object

I have an action that passes a model object to the route to have it deleted. But when I call delete on that object, I get model.destroyRecord is not a function.

  model() {
    return this.store.findRecord('user', 980190980).then((user) => {
      return user.getPlaylists();
    }.bind(this));
  },

  <i class="fa-icon fa fa-trash" aria-hidden="true"  style="margin-top:10px"></i>

  deletePlaylist(playlist) {
    this.get('playlists').removeObject(playlist);
    playlist.destroyRecord();
  }

If I do:

this.store.findRecord('playlist', playlist.id).then(playlist => playlist.destroyRecord());

I get the following error:

Attempted to handle event 'pushedData' while in state root.deleted.inFlight

Aucun commentaire:

Enregistrer un commentaire