I have array called favouriteProducts=[deptName="",item:object(it contains product info like pid,name,brand)] for example
favouriteProducts[0]=deptName:"Fresh food"
item:object
productid:4356178
brand:brand_name
favouriteProducts[3]=deptName:"drinks"
item:object
productid:4356110
brand:brand_name
favouriteProducts[4]=deptName:"drinks"
item:object
productid:4356111
brand:brand_name
when i display the result the ouput is like (using ng-repeat in html)
fresh food
productid:4356178
fresh food
productid:4356179
drinks
productid:43561710
drinks
productid:43561711
But i want output in this way
fresh food
productid:4356178
productid:4356179
drinks
productid:43561710
productid:43561711
can anyone suggest me how to do this?? I want an array like favouriteProducts[0]=deptName:"Fresh food" item:object 0--> productid:4356178 brand:brand_name 1-->productid:4356179 brand:brand_name like this it should appear. department name and respective products