I'm trying to filter the options in a select that uses ng-options but when I add the filter I get no options at all
<select id="players" ng-model="selectedPlayer" ng-options="player.name for player in players track by player.$id | filter:{live:'true'}">
<option value="">Select player</option>
</select>
But the filter works fine in an ng-repeat like this
<div ng-repeat="player in players | filter:{live:'true'}">
{{player.name}}
</div>
You had angular filter
on wrong place. Filter should be applied over a players
collection, it should not be at the end.
Markup
<select id="players" ng-model="selectedPlayer"
ng-options="player.name for player in players | filter:{live:'true'} track by player.$id">
<option value="">Select player</option>
</select>