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 


Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts