I'm learning angularjs and was struggling with selection as well. I know this question is already answered but wanted to share some more code nevertheless.
In my test I have two listboxes: tournament name and tournament city
tournament city should be unique
When i select tournament name it will show up corresponding tournament name list it coming correct only When i seclect city in selectbox it wont populate any thing
app.controller('MainCtrl', function($scope) {
$scope.tournaments = [
{ id: 1, name: 'Banglore Cup', city:'Banglore' },
{ id: 2, name: 'Banglore Cup1', city:'Mumbai' },
{ id: 3, name: 'Banglore Cup2', city:'Banglore' },
{ id: 4, name: 'Mumbai Cup1', city:'Mumbai' },
{ id: 5, name: 'Mumbai Cup2', city:'Banglore' }
];
});
<div class="row">
<div class="col s4 input-field ">
<select class="browser-default" name="show-filter" ng-model="tournamentFilter.id" ng-options="eachTournament.id as eachTournament.name for eachTournament in tournaments">
<option value="" selected> All</option>
</select>
</div>
<div class="col s4 input-field ">
<select class="browser-default" name="show-filter" ng-model="tournamentFilter.city" ng-options="eachTournament.city as eachTournament.city for eachTournament in tournaments| unique:'city'">
<option value="" selected> All</option>
</select>
</div>
</div>
</div>
<div class="col s12">
<table class="list_tournament">
<tbody ng-repeat="eachTournament in tournaments | filter:{id:tournamentFilter.id||undefined} | orderBy:'name'">
<tr class="row nomargin">
<td class="col s4 m3 tournament_list_location">
<a href="#/viewtournament/{{eachTournament.id}}">{{eachTournament.name}}</a>
</td>
<td class="tournament_list_location col s12 m3">
{{eachTournament.city}}
</td>
</tr>
</tbody>
</table>
</div>
Can you help me to getting data