Advertisement
Guest User

caregoryList

a guest
May 27th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .then(function (catList) {
  2.     var categoryList = [];
  3.     catList.forEach(function(category){
  4.         console.log("*******  "+category.id)
  5.         categoryList.push(dao.Product.getAllByCategory(category, t));
  6.         // o sino :
  7.     // categoryList[category.id]=dao.Product.getAllByCategory(category, t));
  8.     })
  9.     return categoryList;
  10.  
  11. // si 'dao.Product.getAllByCategory(category, t))' retorna una promesa(no se que retorna), si fas amb el push, segurament desde fora podras fer un P.all()... Perque tindras una llista de promeses. Sino, si retorna directament category llavors tindras aixo: [caregory1,category2,category3...]
  12.  
  13. // si fas amb el ' categoryList[category.id]=dao.Pr...' tindras una llista aixi:
  14. [ "id1":caregory1 , "id2":category2 , ....]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement