【问题标题】:EmberData unloadAll doesn't work on IE8. Works on Chrome/FireFoxEmberData unloadAll 在 IE8 上不起作用。适用于 Chrome/FireFox
【发布时间】:2015-03-30 12:48:50
【问题描述】:

提前感谢您的帮助!

我在 IE8 上刷新模型时遇到问题。 (适用于 Chrome 和 Firefox) 我运行此代码以使用我的适配器向数据库请求刷新我的模型。通过此命令,我正在卸载模型的数据并再次重新加载以将其显示给用户:

var type = self.controller.get('model').type;

this.controller.get('model').get('store').unloadAll(type);
this.controller.get('model').get('store').fetchAll(type);

没有 Javascript 错误。我一直在寻找解决方案,但对此一无所知。有什么想法吗?

谢谢!

编辑:我有一个解决方案。 IE8 正在缓存 Ember Data 中的 fetchAll() 方法。解决方案是手动设置我不想要缓存的响应头:

缓存控制:无缓存 内容类型:应用程序/json 日期:2015 年 3 月 31 日星期二 09:35:48 GMT 杂注:无缓存 服务器:Apache-Coyote/1.1 传输编码:分块

谢谢!!

【问题讨论】:

    标签: javascript ember.js internet-explorer-8 ember-data ember-cli


    【解决方案1】:

    这可能是因为您直接访问类型,而 ie8 不支持计算属性。你能检查使用正确的 Ember getter 吗?

    var type = self.controller.get('model.type');
    
    this.controller.get('model').get('store').unloadAll(type);
    this.controller.get('model').get('store').fetchAll(type);
    

    您也可以尝试这样的访问控制器: var type = self.get('controller.model.type');

    this.get('controller.model.store').unloadAll(type);
    this.get('controller.model.store').get('store').fetchAll(type);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多