DS.Model#isDeleted

isDeleted{Boolean}

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

If this property is true the record is in the deleted state and has been marked for deletion. When isDeleted is true and hasDirtyAttributes is true, the record is deleted locally but the deletion was not yet persisted. When isSaving is true, the change is in-flight. When both hasDirtyAttributes and isSaving are false, the change has persisted.

Example

var record = store.createRecord('model');
record.get('isDeleted');    // false
record.deleteRecord();

// Locally deleted
record.get('isDeleted');           // true
record.get('hasDirtyAttributes');  // true
record.get('isSaving');            // false

// Persisting the deletion
var promise = record.save();
record.get('isDeleted');    // true
record.get('isSaving');     // true

// Deletion Persisted
promise.then(function() {
  record.get('isDeleted');          // true
  record.get('isSaving');           // false
  record.get('hasDirtyAttributes'); // false
});
doc_EmberJs
2016-11-30 16:50:09
Comments
Leave a Comment

Please login to continue.