Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html ng-app='Test'>
<head>
  <script src="http://code.angularjs.org/1.1.1/angular.min.js"></script>
  <meta charset=utf-8 />
  <title>JS Bin</title>
</head>
<body ng-controller='Ctrl'>
  <div ng-repeat='letter in letters | inArray:filterBy:"id"'>{{letter.id}}</div>
</body>
</html>
 
angular.module('Test', [])
.filter('inArray', function($filter){
    return function(list, arrayFilter, element){
        if(arrayFilter){
            return $filter("filter")(list, function(listItem){
                return arrayFilter.indexOf(listItem[element]) != -1;
            });
        }
    };
});
function Ctrl($scope) {
  $scope.letters = [
    {id: 'a'},
    {id: 'b'},
    {id: 'c'},
    {id: 'd'},
    {id: 'e'}
  ];
  
  $scope.filterBy = ['b', 'c', 'd'];
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers