Hi,
I have a model with a many to many relationship eg products and categories.
In my category model I have this
export default DS.Model.extend({
name: DS.attr('string'),
products:DS.hasMany('product')
});
In my category template I can view the related products eg
{{#each model.data.products as |item|}}
{{item.name}}
{{/each}}
What I want to do is obtain the data within a child route for using within a component.
In my child route (item), I can grab the model for the parent route (items) which gives me the product categories (and I assume also) the related products for each of those categories…
model(params) {
let model = this.modelFor('product.items')
}
However, I’m struggling to obtain the data so I can pass it to a component within the model hook… I thought I could do something like model.data.get(‘products’) but that’s not correct.
Many thanks in advance.