lundi 6 juillet 2015

Collect all the products of given categories

A category hasMany products. How can I collect the products of a couple of categories? This code doesn't work:

controller.js

productsOfSelectedCategories: Ember.computed('selectedCategories', 'model.products', function() {
  var selectedCategories = this.get('selectedCategories');
  var products;

  productsOfSelectedCategories.map((category) => {
    products.push(category.products);
  })

  return products;
}),




Aucun commentaire:

Enregistrer un commentaire