Permalink
Browse files

Add option for when arrayFilter is not defined

  • Loading branch information...
bignall committed Aug 21, 2016
1 parent 887f792 commit 4db424730a965347a103d4e0640d2e25cdc0de33
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/_filter/array/in-array.js
@@ -6,14 +6,16 @@
* @description
* filter an array by a property in another array based on example http://jsbin.com/owIXEPE/2/edit?html,js,output
*/
angular.module('a8m.filter-by', [])
.filter('inArray', function($filter){
angular.module('a8m.in-array', [])
.filter('inArray', function($filter) {
return function(list, arrayFilter, element){
if(arrayFilter){
return $filter("filter")(list, function(listItem){
if (arrayFilter) {
return $filter("filter")(list, function(listItem) {
return arrayFilter.indexOf(listItem[element]) != -1;
});
} else {
return list;
}
};
}
});

0 comments on commit 4db4247

Please sign in to comment.