I am trying to get unique results in angular ng-options on a select box.
<select ng-model="nationality" id="nationality"
ng-options="player as player.nationality for player in players></select>
The above code will get me all the nationality's however it show's duplicates.
<select ng-model="nationality" id="nationality"
ng-options="player as players | unique: 'player.nationality'"></select>
When I try this code angular throw's errors and shows me nothing in the select box.
Controller
var app = angular.module('premierLeagueDB', []);
app.controller('mainCtrl', function($scope, $http) {
$http({
method : "GET",
url : "api.php/clubs",
}).then(function mySucces(response) {
$scope.clubs = response.data.club;
}, function myError(response) {
$scope.showError = response.statusText;
});
});
Thanks.