I've been trying to implement filtering JS Map Object (array indexed by an id) instead of the usual js array in angularJS.
For illustration, below is a slight modification of the filtering example as provided in the AngularJS docs.
http://plnkr.co/edit/bNzePyuAAmP6Nl6hj5bI?p=preview
I have converted the input array (friends) to a JSON object with each initial array element mapped as individual keyed element. This modification can be understood below:
Initial (as shown in AngularJS docs):
friends = [{name:'John', phone:'555-1276'},
{name:'Mary', phone:'800-BIG-MARY'},
{name:'Mike', phone:'555-4321'},
{name:'Adam', phone:'555-5678'},
{name:'Julie', phone:'555-8765'}]
Modified:
friends = {1:{name:'John', phone:'555-1276'},
2:{name:'Mary', phone:'800-BIG-MARY'},
3:{name:'Mike', phone:'555-4321'},
4:{name:'Adam', phone:'555-5678'},
5:{name:'Julie', phone:'555-8765'}}
Can someone provide a way to filter such an input as part of the ng-repeat directive filter expression. I understand that 'friends' is no longer an array but an object, however since ng-repeat directive is working on this object, perhaps there is a way to filter it as well?
Thanks.