JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="picklistTest">
<div ng-controller="myController">
<button type="button" ng-click="setAnswerToThree()">Set Answer To Three</button>
<select ng-model="question.answer" ng-options="opt as opt.Value for opt in question.options track by opt.id" />
</div>
</div>
CSS
</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ -->
<script src="https://code.angularjs.org/1.2.9/angular.js"></script>
<style>
JavaScript
var app = angular.module('picklistTest', ['ngLocale']);
app.controller("myController", function($scope) {
$scope.question = {
options: [
{
id: 1,
Value: "One"
},
{
id: 2,
Value: "Two"
},
{
id: 3,
Value: "Three"
}
]
};
$scope.$watch('question.answer', function() {
console.log('answer is:');
console.log($scope.question.answer);
});
$scope.setAnswerToThree = function() {
$scope.question.answer = {
id: 3,
Value: "Three"
};
};
});