ng-model example

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js"></script>
<div ng-controller="ControllerA" ng-app>
    Simple options<br/>
    <select ng-options="value for (key, value) in optionsObject " ng-model="chosenO">
</select><br/>
    chosenO = {{chosenO}}<br/>
    <br>
        Please press tab to go to next field
    <hr/>    
    
    Simple Object with key as value<br/>
    Press "I" twice and notice the chosen value.<br><br>
    <select ng-options="value as key for (key, value) in optionsObject " ng-model="chosenO1">
</select><br/>
    chosenO1 = {{chosenO1}}<br/>
</div>

JavaScript

function ControllerA($scope) {
    $scope.optionsArray = [1,2,3,4,5];
    $scope.optionsObject = {"India" : "IN" , "Singapore" : "SG", "Malaysia" : "MY", "Indonesia" : "INDY"};
 
}