Angularjs filter always returns true
I've made filter for ng-repaet that looks like this:
$scope.filterRoutine = function(col) {
return _.isEqual(col.Routine.IsIndoor, true);
}
It works fine (isEqual returns true or false).
But this doesn't work, and I don't know why is that (when I say it doesn't
work, I don't get any errors, but view doesn't change)
$scope.filterRoutine = function(col) {
return _.forEach(tempData, function (temp) {
if (_.find(col.Exercises, { Exercise: temp })) {
return true;
} else {
return false;
}
});
}
What I do here (or rather what I want to do) is this: I have tempData
collection, if my col.Exercises has at least one item from tempData it
should be showed in the view. But for some reason all items are showed in
the view i.e. nothing has been filtered.
My guess is that this because this function always returns true (because
always at least one col.Exercises should contain item from tempData).
How can I fix this i.e. hide all cols which don't contain any items from
tempData ?
No comments:
Post a Comment