I have 2 models one called dimension the other called dimensionChoice, a dimension has dimensionChoices and a dimensionChoice can have children dimensionChoices, I get the dimension and side load all the dimensionChoices and I can look in Ember inspector and drill into the dimension choices for a dimension then I go into one of the dimensionChoices in that HasMany array and that is where things get strange. If I drill into the children array I get a content of an empty array, but if I look under the DS.Model for that choice I can see the children array in data and it is populated. I have spent many hours and now days trying to figure out why the data is not in the content of the component that I am passing it too, and I have been unable to figure out what is going on.
Basic setup is:
App.Dimension = DS.Model.extend({
name: DS.attr('string'),
...
choices: DS.hasMany('dimensionChoice')
});
App.DimensionChoice = DS.Model.extend({
name: DS.attr('string'),
...
children: DS.hasMany('dimensionChoice')
});
I am trying to create nested components in the main view
Main View
<div>
{{#each dimension}}
{{dimension-selector dimension=this}}
{{/each}}
</div>
Dimension Selector Component
<div>
{{dimension.name}}
{{#each dimension.choice}}
{{dimension-choice-selector choice=this}}
{{/each}}
</div>
Dimension Choice Selector Component
<div>
{{choice.name}}
{{#each choice.children}}
{{dimension-choice-selector choice=this}}
{{/each}}
</div>
The first level of choices, the ones under the dimension show fine, but the ones under the children array of each choice don't and that was what I was talking about in the inspector.
Any help with this would be greatly appreciated and if you want to see larger snippets of actual code I can provide them
Thanks
Aucun commentaire:
Enregistrer un commentaire