How to represent arrays within ember-data models?

前端 未结 7 1154
不思量自难忘°
不思量自难忘° 2020-12-05 00:29

Is it necessary to use DS.hasMany pointing to a DS.Model when a model contains an array? Even if the array elements are not really models (no IDs o

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-05 01:13

    If you absolutely need a custom data structure to be exchanged with your server, you can enrich DS.attr.transforms and declare a new array codec, for example.

    See source code for existing attribute codecs implementation. It is a good place to start adding your own.

提交回复
热议问题