Filter by Object Property in Ng-Repeat – AngularJS

Hey everyone,

Just a quick post on how to filter by a property when using ng-repeat. To start with, we’ll use the following objects:

	"regions": [
			"id": "1",
			"postcode": "4700",
			"name": "Rockhampton",
			"description": "One of the major cities in Central Queensland."
			"id": "16",
			"postcode": "4214",
			"name": "Keppel Island",
			"description": "Awesome islands, very few people, heaps of fish beautiful clear water."

Then assuming you want to filter by the postcode all you need is the following:

<input type='number' size='4' max='9999' ng-model='search_postcode'/>
<div id='regions'>
	<div ng-repeat='region in regions | filter: {postcode: search_postcode}'>

3 thoughts on “Filter by Object Property in Ng-Repeat – AngularJS

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.