I have an array of objects and I need to return object containing specific property.
$scope.foobar = [
{"id": 15, "name": "bar1"},
{"id": 25, "name": "bar2"},
{"id": 215, "name": "bar3"},
{"id": 7415, "name": "bar4"}
];
I need to assign a new variable with the object where id is 25. The following does not work:
<div ng-init="item = foobar | filter: { id: 25 }">...</div>
How can I use angular filter without ng-repeat to select the subset of items from array and return it as a new array.
forEachloop, but I wonder if there's a built-in way to select the subset of items from array in angular.<div ng-repeat="foo in foobar | filter:{id:25}">