Reputation: 49
$scope.gradeC = $filter('filter')($scope.results.subjects, {grade: 'C'})[0];
This will give matched results.
Any idea on how to filter only exact matches?
Upvotes: 0
Views: 2074
Reputation: 2448
You can pass a strict comparator flag as an argument to the filter.
$scope.gradeC = $filter('filter')($scope.results.subjects, {grade: 'C'}, true)[0];
Ref: Angular filter doc
Upvotes: 3