I have a filter in place,
if
the filtered results for criteria is >0
, i get the results displayed. In the case where the criteria itself returns an empty list, well, i'll juts get an empty list else
, i returns all items.
Id' like to adapt my code so that if a criteria is selected but outputs an empty list, it should rpint on screen a DIV initially set in display:none
I am thinking about putting an if/else
statement within the second else
, but could not get the right syntax...or may be it is juts a bad idea ?
.filter('selectedDishType', function() {
return function(dishes, dishTypes) {
console.log(dishTypes);
if (dishTypes.length > 0) {
return dishes.filter(function(dish) {
return dishTypes.indexOf(dish.dishCategory.toLowerCase()) != -1;
});
} else {
return dishes;
}
};
})