How to access nested object in json with Ember data

前端 未结 3 1959
栀梦
栀梦 2020-12-16 21:19

I\'m using Ember data and having a hard time figuring out get ember to recognize nested properties in my JSON response from the server. This is ember-1.0.0-pre.4.js.

<
3条回答
  •  孤街浪徒
    2020-12-16 21:52

    Since you're embedding the addr JSON in your schools JSON you need to setup the mapping in the DS.RESTAdapter.

    DS.RESTAdapter.map 'App.School',
      addr: { embedded: 'always' }
    

    The embedded option can have two values, 1) always, 2) load.

    See Yehuda's answer here for the details: https://stackoverflow.com/a/14324532/1409279

提交回复
热议问题