Angularjs

Filter Object On Exact Match In AngularJS

Posted by Weston Ganger on July 13, 2015

I wanted to filter my ng-repeat list but I only wanted exact matches not all that contain the value.

All you have to do is add a flag to tell it to get exact matches


<div ng-repeat="post in posts | filter:{'id':  1}:true">

The ‘:true’ portion tells it to get only exact matches which would be ID == 1

If you set it to ‘:false’ which it does by default it would match 1, 11, 21, 31, etc…


Related External Links:


Posted in Angular and Tagged with angularjs filter 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts