Skip to content Skip to sidebar Skip to footer

Nested Filtering With Angular.js Version 1.2.18

I'm experimenting with AngularJS for the first time. I do repeat a template based on JSON data, which here is a sample: $scope.users = [ {name: 'first user', status: {name: 'em

Solution 1:

It's a breaking change introduces in AngularJS 1.2.11. It has been decided to not mark it as such, because it was not a tested nor a documented behaviour.

Since this release, myObject | filter:{'key.subkey':'search'} will search the string search into myObject['key.subkey'] and no more in myObject['key']['subkey'].

A new syntax was introduced in AngularJS 1.2.13, which seems to me more natural, to search in nested object: myObject | filter:{key : {subkey : 'search'}}. That's the solution you're looking for.

<p ng-repeat="user in users | filter:{status : {name: 'employee'}}">{{user.name}}</p>

Post a Comment for "Nested Filtering With Angular.js Version 1.2.18"