So if I have an array:
$scope.letters =
[{\"id\":\"a\"},
{\"id\":\"b\"},
{\"id\":\"c\"}];
And another array
$scope.filter
You should try something like that:
JS:
angular.module('Test', []);
function Ctrl($scope) {
$scope.letters = [
{id: 'a'},
{id: 'b'},
{id: 'c'}
];
$scope.filterBy = ['b', 'c', 'd'];
$scope.filteredLetters = function () {
return $scope.letters.filter(function (letter) {
return $scope.filterBy.indexOf(letter.id) !== -1;
});
};
}
Ctrl.$inject = ['$scope'];
HTML:
{{letter.id}}
You can try live example.