AngularJS filters are great, but I want to enhance them by adding a function that can check if a value is in an array.
For example, let's say we have the following data:
Queue = [
{'Name':'John','Tier':'Gold','Status':'VIP'},
{'Name':'Anna','Tier':'Silver','Status':'Normal'},
{'Name':'Luke','Tier':'Gold','Status':'Normal'},
{'Name':'Mary','Tier':'Bronze','Status':'Normal'},
{'Name':'Jess','Tier':'Bronze','Status':'VIP'},
];
Priority = ['Gold','Silver'];
I want to display the names of Priority members who are also VIPs.
<div ng-repeat="people in Queue | filter: {Tier:Priority} | filter: {Status:'VIP'}">{{ people.Name }}</div>
I would like to update the filter so it can compare Tier with items in the Priority array.
I've tried creating a custom filter with AngularJS, but I'm struggling to make it as versatile as the existing one, which can handle objects, strings, and functions seamlessly.
My focus isn't just on checking if an item exists in an array, but on developing a filter that can differentiate between strings and arrays while maintaining the functionality of the current filter.