destroyRecord (options) Promise
Same as deleteRecord
, but saves the record immediately.
Example
app/routes/model/delete.js
1 2 3 4 5 6 7 8 9 10 11 12 | import Ember from 'ember' ; export default Ember.Route.extend({ actions: { delete : function () { var controller = this .controller; controller.get( 'model' ).destroyRecord().then( function () { controller.transitionToRoute( 'model.index' ); }); } } }); |
If you pass an object on the adapterOptions
property of the options argument it will be passed to you adapter via the snapshot
1 | record.destroyRecord({ adapterOptions: { subscribe: false } }); |
app/adapters/post.js
1 2 3 4 5 6 7 8 9 10 | import MyCustomAdapter from './custom-adapter' ; export default MyCustomAdapter.extend({ deleteRecord: function (store, type, snapshot) { if (snapshot.adapterOptions.subscribe) { // ... } // ... } }); |
Parameters:
-
options
Object
Returns:
-
Promise
- a promise that will be resolved when the adapter returns successfully or rejected if the adapter returns with an error.
Please login to continue.