This query was originally posted on this thread
I am looking to implement a filter that will display the values of colors.name only if they also exist in cars.color
$scope.colors = [{"name":"blue","count":2},
{"name":"red","count":12},
{"name":"pink","count":5},
{"name":"yellow","count":2}];
$scope.cars=[ {"brand":"Ford","color":"blue", "seat":"pink"}
,{"brand":"Ferrari","color":"red", "seat":"pink"}
,{"brand":"Rolls","color":"blue","seat":"pink"}];
When displaying in the view:
<ul>
<li ng-repeat="n in colors | filter: filteredColors"> {{n}}
</li>
</ul>
The expected outcome is:
I am seeking a solution without using ES6, and I prefer to have the filter logic within the controller. Visit the following plunkr here. Thank you in advance!