angularjs - Angular - Filtering an ng-repeat by Item.User._id -


im trying filter ng-repeat id value.

$scope.filter = $stateparams.id;  --> 56a1832a36dc3d0e00c7aa3f 

heres model item object relevant vlues

var itemschema = new schema({    title: {     type: string,     maxlength: 150   }   user: {     type: schema.objectid,     ref: 'user'   }  }); 

how filter items user._id ?

my attempt giving no results.

<div ng-repeat="saving in savings| filter: {user : 'filter'}"> 

https://plnkr.co/edit/sihbure9vnko0jb1wk8b

the docs explain using filters well. filter filters array property pass it. if it's object, match properties against each item in array. means item in array property user: {_id: 2} shown.

<div ng-repeat="saving in savings | filter:{user: {_id: 2}}">{{saving.title}}</div> 

you can checkout this question example.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -