I have the following data in a table:
data = [
{id: 1, name: 'Manchester United', type: 'Soccer', featured: true, country: 'England'},
{id: 2, name: 'Manchester City', type: 'Soccer', featured: false, country: 'England'},
{id: 3, name: 'Dallas Mavericks', type: 'Basketball', featured: true, country: 'USA'},
{id: 4, name: 'Indian Cricket Team', type: 'Cricket', featured: true, country: 'India'},
{id: 5, name: 'Australian Cricket Team', type: 'Cricket', featured: false, country: 'Australia'},
{id: 6, name: 'Los Angeles Lakers', type: 'Basketball', featured: true, country: 'USA'},
{id: 7, name: 'Los Angeles Clippers', type: 'Basketball', featured: false, country: 'USA'}
];
I want to add a drop down box with countries. Selecting a country should filter the table to show only sports from that country.
The problem is that I am unable to show the unique countries in the dropdown.
Kindly Help...Thanks in advance.
I modified your plnkr, http://plnkr.co/edit/60GO0zhSGoEUm7tu6mbc?p=preview
Filter: as it is from ng-options and unique filter not displaying angular.js
Select part: <select data-ng-model="countryModel" ng-options="dd.country as dd.country for dd in data | unique:'country'">
ng-repeat part <tr data-ng-repeat="dat in data | filter: countryModel" data-ng-style="set_color(dat)">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.