0

$scope.gradeC = $filter('filter')($scope.results.subjects, {grade: 'C'})[0];

This will give matched results.

Any idea on how to filter only exact matches?

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.