【发布时间】:2014-09-20 17:15:37
【问题描述】:
我有两个模型:
Question = DS.Model.extend
answers: DS.hasMany("answer")
Answer = DS.Model.extend
question: DS.belongsTo("question")
json 提供嵌入问题中的答案:
"questions": [{
"id":"1.04"
"text":"What is the position or title of the 1% who is being protested against?",
"answers":[
{
"text":"City mayor",
"id":"1.04.02"
},
{
"text":"City council member",
"id":"1.04.03"
},
{
"text":"CEO of some company",
"id":"1.04.01"
}
]
}]
当我调用question.get('answers') 时,Ember 返回预期的答案数组。但是,如果我打电话给answer.get('question'),我会得到空值。知道为什么会这样吗?
【问题讨论】:
标签: ember.js ember-data