I get many objects from my database which has the following structure:
$scope.user = {
"surname" : "Kowalsky",
"name" : "Jan",
"subject_id" : ["123","678"]
}
I need to display all users (surnames and names) which have "123" in the subject_id
array.
I tried to do it in ng-repeat
but it doesn't work.
<div ng-repeat="user in userList | filter: {user.subject_id:'123'}">
<b>Surname: </b>{{user.surname}}
<b>Name: </b>{{user.name}}
</div>
Also, I tried it in the controller but it also didn't work:
$scope.userFilter = $filter('filter')($scope.users.subject_id: '123')[0];