Ember使响应正常化

时间:2015-11-27 21:31:30

标签: ember.js ember-data ember-cli

我正在扩展JSONSerializer以适应我的服务器响应,如下所示:

{
  "result": {
    "items": [
      {
        "id": "...",
        "title": "...",
        ...
      },
      ...
    ],
      "total": number,
      "...": "..."
  }   
}

因此我覆盖了normalizeResponse()方法:

normalizeResponse: function(store, primaryModelClass, payload, id, requestType) {
        payload = payload.result.items;

        return this._super(store, primaryModelClass, payload, id, requestType)
    },

之后,我的模型数据字段全部为undefined。我做错了什么?

0 个答案:

没有答案