Filter on nested JSON

I’m trying to make a filter on a nested JSON. When I use the default filter:query, it looks at all the propertys in the JSON, I only want to look at a few. This is my JSON:


<ion-item ng-repeat="user in data | filter:{'user.lastName':query}" item="item"> doesn’t work, when I use “id” instead of user.lastName it works fine. Without the ’ ’ it doesn’t work either, and filter:{user:{lastName:query}} doesn’t work either.
Any thoughts ? Thanks in advance

It’s likely you are going to need to create a custom fliter:

That worked, thanks a lot. Was hoping I could use the default angularjs filter, but apparently not.

The default AngularJS filters only work on arrays, not objects - if you could re-structure your object you could use the default filters much like in your original code, but you’ll have more flexibility with a custom filter.

When I added track by id, this solution does not work… :confounded: