Ember를 처음 사용하고 디스플레이에 문제가 있습니다. 많은 관계가 있습니다.Emberjs 최대 호출 스택을 표시 할 때 hasMany
내 모델 :
App.Shop = DS.Model.extend({
name: DS.attr('string'),
openSettings: DS.hasMany('App.OpenSetting')
});
App.OpenSetting = DS.Model.extend({
title: DS.attr('string'),
data: DS.attr('string'),
shopId: DS.belongsTo('App.Shop')
});
나는이지도 : 스크립트에 index.html을에서
DS.RESTAdapter.map('App.Shop', {
openSettings: { key: 'openSettings' }
});
DS.RESTAdapter.map('App.OpenSetting', {
shopId: { key: 'shopId' }
});
난이 :
{{#each model}}
{{id}} - {{name}} #
{{#each openSettings}}
{{title}}
{{/each}}
{{/each}}
그러나 객체 숍 openSettings에서 어떤 관계를 가질 때 (openSettings : [1,2]) 그러면 오류가 발생합니다.
Uncaught RangeError: Maximum call stack size exceeded
내가 뭘 잘못하고있어?
설비 : 도움을
App.Shop.FIXTURES = [
{
name: "Supermarket",
id: 2,
openSettings: [
2, 5
]
}
];
App.OpenSetting.FIXTURES = [
{
title: "monday - friday",
data: "8:00 - 24:00",
id: 2,
shopId: 2
},
{
title: "saturday",
data: "8:00 - 1:00",
id: 5,
shopId: 2
}
];
감사합니다.
해결책이 있습니다. Ember dont는 "data"라는 필드를 좋아하지 않습니다 ... – thunder
당신은 자신의 질문에 대한 대답으로 그것을 게시 할 수 있으며, 같은 문제를 가지고 미래에이 문제에 직면하게되는 사람들에게 올바른 것으로 표시 할 수 있습니다. =) – Anonymous