1
我正在尝试从距离滑块中构建滤波器。带OR运算符的角度滤波器
是否可以设置当我的范围滑块位于其中一个位置以显示多个类别时?
通过下面的代码,我可以使用范围进行过滤,但他只在第一个单词上插入过滤器,并且仅在OR操作符后面放置过滤器。任何人都可以帮助我?
$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}">
我已经在这里看到其他帖子,但仍然没有得到我如何做到这一点。 =(
感谢丹尼尔,这里的工作解决方案:
$scope.projetos = [];
$scope.filtroRange = filtroRange;
function filtroRange() {
if (this.rangemodel == 1) {
$scope.categoryFilter = function(projeto) {
if (projeto.categoria === 'site institucional' || projeto.categoria === 'ecommerce') {
console.log('filtrando');
return projeto;
}
};
} else if (this.rangemodel == 2) {
$scope.categoryFilter = function(projeto) {
if (projeto.categoria === 'branding' || projeto.categoria === 'email marketing') {
console.log('filtrando');
return projeto;
}
};
}
};
https://stackoverflow.com/questions/15868248/how-to-filter-multiple-values-or-operation-in-angularjs –
[如何在angularJS中过滤多个值(OR操作)](https://stackoverflow.com/questions/15868248/how-to-filter-multiple-values-or-operation-in-angularjs) –