Skip to content

Commit e73af37

Browse files
committed
Support multiple keywords
1 parent f7bbfc4 commit e73af37

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/scripts/app.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,22 @@ angular.module('abstackVarLib', ['zeroclipboard'])
3737
};
3838
})
3939
.filter('keywords', function(){
40+
function compare(origin, target){
41+
origin = origin.join('');
42+
for(var i = 0;i<target.length;i++){
43+
if(origin.indexOf(target[i]) != -1)
44+
return true;
45+
}
46+
return false;
47+
}
48+
4049
return function(input, type){
4150
if(!type)
4251
return input;
4352

4453
var temp = [];
4554
for(var i = 0;i<input.length;i++){
46-
if(input[i].tags.join().indexOf(type) != -1)
55+
if(compare(input[i].tags, type.split(' ')))
4756
temp.push(input[i]);
4857
}
4958

0 commit comments

Comments
 (0)