How can I create a filter with a range slider that shows multiple categories when it's in a certain position?
I have tried using the code below to filter based on the range, but it only captures the first word after the OR operator. Can anyone provide assistance?
$scope.filterRange = filterRange;
function filterRange() {
if (this.rangemodel == 1) {
$scope.categoryfilter = 'web' || 'ecommerce '; // something like that!
} else if(this.rangemodel == 2) {
$scope.categoryfilter = 'branding' || 'video'; // something like that!
};
};
<div ng-repeat="project in projects | filter: {category: categoryfilter}">
I have looked at other posts, but I'm still struggling to make this work. =(
Thanks to Daniel, here is the solution:
$scope.projects = [];
$scope.filterRange = filterRange;
function filterRange() {
if (this.rangemodel == 1) {
$scope.categoryFilter = function(project) {
if (project.category === 'institutional site' || project.category === 'ecommerce') {
console.log('filtering');
return project;
}
};
} else if (this.rangemodel == 2) {
$scope.categoryFilter = function(project) {
if (project.category === 'branding' || project.category === 'email marketing') {
console.log('filtering');
return project;
}
};
}
};