I am trying to get the exact key match of object array in angularjs instead of that I am getting all matching results. How can i achieve that?
here is the controller code:-
var myApp = angular.module('myApp', []);
myApp.controller('ToddlerCtrl', function ($scope,$filter) {
$scope.toddlers = [
{
"name": "Toddler One",
"tid": "85",
},
{
"name": "Toddler Two",
"tid": "485",
},
{
"name": "Toddler Three",
"tid": "4485",
} ,
{
"name": "Toddler Four",
"tid": "8845",
}
];
var found = $filter('filter')($scope.toddlers, 85 );
console.log(found); // I want the exact match i.e. ("Toddler one" with "85" only) but I am getting 3 results.
});