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) –