I am having different objects like in the code sample below. I have some checkboxes that filters based on brewer, style, aroma and country. It is filtering only by their first property in the array if the array contains more elements.
All the code is too long to post it here. Because of its complexity I am having troubles to debug it.
What is the best solution to make the filter work based on all the elements in the array? I checked some other questions and I couldn't find anything related. It will be great if any of you could help me.
Thanks.
app.controller('namesCtrl', function($scope, $http, $timeout, $modal, $log, $locale, ngCart) {
$scope.names =
[{"key":{"kind":"Beer","id":4916395376640000},
"name":"name1",
"brewers":["brewer1"],
"styles":["style1"],
"aromas":["aroma1"],
"countries":["country1"]},
{"key":{"kind":"Beer","id":5124589889781760},
"name":"name2",
"brewers":["brewer1", "brewer3"],
"styles":["style1"],
"aromas":["aroma1"],
"countries":["country1"]},
{"key":{"kind":"Beer","id":5206065687822666},
"name":"name3",
"brewers":["brewer2"],
"styles":["style2","style1"],
"aromas":["aroma1","aroma2","aroma3"],
"countries":["country1"]},
{"key":{"kind":"Beer","id":5755685136498688},
"name":"name4",
"brewers":["brewer1"],
"styles":["style3"],
"aromas":["aroma1", "aroma2", "aroma3"],
"countries":["country1","country2"]},
{"key":{"kind":"Beer","id":4916395376640666},
"name":"name5",
"brewers":["brewer1"],
"styles":["style1"],
"aromas":["aroma1","aroma2","aroma5"],
"countries":["country1"]},
{"key":{"kind":"Beer","id":5124589889781760},
"name":"name6",
"brewers":["brewer1", "brewer3"],
"styles":["style1"],
"aromas":["aroma1"],
"countries":["country1"]},
{"key":{"kind":"Beer","id":5206065687822336},
"name":"name7",
"brewers":["brewer1"],
"styles":["style3","style4"],
"aromas":["aroma6","aroma1","aroma7","aroma2"],
"countries":["country1"]},
{"key":{"kind":"Beer","id":5755685136498688},
"name":"name8",
"brewers":["brewer1"],
"styles":["style3"],
"aromas":["aroma1", "aroma2", "aroma3"],
"countries":["country1"]},
{"key":{"kind":"Beer","id":6212000178765824},
"name":"name9",
"brewers":["brewer1"],
"styles":["style1"],
"aromas":["aroma1"],
"countries":["country1"]},
{"key":{"kind":"Beer","id":6282187997446144},
"name":"name10",
"brewers":["brewer1"],
"styles":["style5"],
"aromas":["aroma6","aroma7","aroma8"],
"countries":["country1"]
}];
Aucun commentaire:
Enregistrer un commentaire