【问题标题】:Convert custom json payload to something Ember Data understands?将自定义 json 有效负载转换为 Ember Data 可以理解的内容?
【发布时间】:2014-03-17 10:40:16
【问题描述】:

所以我们正在制作一个带有 rest-y json http api 的应用程序。服务器如何返回它的数据超出了我的能力范围,并且它与 Ember Data 的假设不兼容。

如何配置 RESTAdapter 来转换负载?要编辑的 DS api 的正确部分是什么?

【问题讨论】:

    标签: json ember.js ember-data


    【解决方案1】:

    好的,所以发现了这一点。余烬

    自定义RESTSerializer

    App.ApplicationSerializer = DS.RESTSerializer.extend({
      extractArray: function () {
        // Your custom magick
      },
      extractSingle: function () {
        // You wizardry for when single objects are returned
      }
    });
    

    【讨论】:

      猜你喜欢
      • 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
      相关资源
      最近更新 更多