The following code shows how to do option Select on a property by another property ordered by third property.
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script>
var app = angular.module('myApp', []);
<!-- w w w . j a v a 2 s . c om-->
app.controller('MainCtrl', function($scope) {
$scope.countriesByCode = {
'AF' : 'AngularJS',
'BJ' : 'Beijing',
'BM' : 'BMW'
};
$scope.countriesByName = {
'AngularJS' : 'AF',
'Beijing' : 'BJ',
'BMW' : 'BM'
};
$scope.getFullName = function(user) {
return user.firstName + ' ' + user.lastName;
};
});
</script>
</head>
<body ng-controller="MainCtrl">
<select ng-model="chosenCountryCode" ng-options="code as name for (code, name) in countriesByCode"></select>
Selected Country Code: {{ chosenCountryCode }}
</body>
</html>
The code above is rendered as follows: