如何从Ember Data存储中删除所有数据? [英] How to delete all data from Ember Data store?
本文介绍了如何从Ember Data存储中删除所有数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在正在开发的Ember.js应用程序中,使用Ember数据,一旦用户到达屏幕上的某个点,我想删除存储在与应用程序相关联的ember-data Store中的所有状态,并从可以开始从服务器拉取数据的干净的slate开始。任何人都知道如何做?
In the Ember.js application I'm working on, that uses Ember-data, once the user gets to a point on the screen, I want to delete all state stored in the ember-data Store associated with the application, and start with a clean slate that can start pulling data from the server. Anyone know how to do it?
推荐答案
我不认为有一个简单的方法。 ATM的唯一方式就是循环使用您所有的 DS.Model
类,并单独销毁记录。
I don't think there is an easy way. The only way ATM is loop over all your DS.Model
classes and destroy the records individually.
App.Model.all().forEach(model) ->
model.destroy();
App.Model2.all().forEach(model) ->
model.destroy()
这篇关于如何从Ember Data存储中删除所有数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文