1

is it possible to define a polymorphic hasMany relationship in js-data?

For example, a User has many animals, where an Animal can be a Cat or a Dog (ES6/TS class Dog extends Animal). If I request user.animals, I should receive a collection of cats and dogs, which may have their own custom properties.

I can't figure out from the docs how to setup my resource. Ember Data supports this.

4

1 回答 1

1

根据文档,它可以使用 js-data 2.0,http://www.js-data.io/docs/relations

检查这些 js-data hasMany 示例,将是解决您问题的快速提示

http://www.js-data.io/docs/examples#relations

于 2016-05-07T18:37:24.073 回答