DS.Model#deleteRecord()

deleteRecord

Defined in addon/-private/system/model/model.js:500

Marks the record as deleted but does not save it. You must call save afterwards if you want to persist it. You might use this method if you want to allow the user to still rollbackAttributes() after a delete it was made.

Example

app/routes/model/delete.js
import Ember from 'ember';

export default Ember.Route.extend({
  actions: {
    softDelete: function() {
      this.controller.get('model').deleteRecord();
    },
    confirm: function() {
      this.controller.get('model').save();
    },
    undo: function() {
      this.controller.get('model').rollbackAttributes();
    }
  }
});
doc_EmberJs
2016-11-30 16:50:06
Comments
Leave a Comment

Please login to continue.