I received an array from a REST service and I am attempting to generate a dropdown menu based on that data.
Check out the jsfiddle example here
$scope.reasons = [{
"languageLanguageId": {
"languageId": 1,
"lastUpdate": "2015-05-08T11:14:00+03:00",
"name": "eng"
},
"returnText": "reason1",
"returnreasonId": 1}, {
"languageLanguageId": {
"languageId": 1,
"lastUpdate": "2015-05-08T11:14:00+03:00",
"name": "eng"
},
"returnText": "reason2",
"returnreasonId": 2}, {
"languageLanguageId": {
"languageId": 1,
"lastUpdate": "2015-05-08T11:14:00+03:00",
"name": "eng"
},
"returnText": "reason3",
"returnreasonId": 3
}];
HTML
<div class="col-md-10">
<select ng-model="reasons" ng-options="p.reason as (p.returnText + '('+p.returnreasonId+')') for p in reasons"></select>
</div>
<div class="col-md-10">
<select ng-model="reasons" ng-options="p.returnreasonId as p.returnText for p in reasons"></select>
</div>