How to display two values using ng-options in AngularJs?
If you don't want to make any changes to the filter use this select:
<select ng-model="filterDeck.deckDetail" ng-options="deck as deck.name + ' - ' + deck.level for deck in data">
The above option will bind the entire object to the model.
If you just want to bind the id to the model you need to update your select and filter to the following :
<select ng-model="filterDeck.deckDetail" ng-options="deck.id as deck.name + ' - ' + deck.level for deck in data">
Then update your filter to this:
$scope.customDeck = function (data) {
if (data.id === $scope.filterDeck.deckDetail) {
return true;
} else {
return false;
}
};
Either way will work.