How to delete all data from Ember Data store? [duplicate]

自古美人都是妖i 提交于 2019-12-12 13:58:50

问题


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?


回答1:


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()


来源:https://stackoverflow.com/questions/15167703/how-to-delete-all-data-from-ember-data-store

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!