How can I load only the products of a given category in the route.js? My current route.js loads the first category but all products. But I only want the products of the first category.
app/category/model.js
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr('string'),
products: DS.hasMany('product', { async: true })
});
route.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return {
category: this.store.find('category', 1),
products: this.store.find('product')
};
}
});
Aucun commentaire:
Enregistrer un commentaire