AngularJS gn-options Demo:
Works in AngularJS 1.0.2 but not in 1.4.2.
HTML
<div ng-app="myApp">
<h2>AngularJS ng-options Demo</h2>
<p>Works in AngularJS 1.0.2 but not in 1.4.2.</p>
<div ng-controller="QuarterController">
<select name="quarter" ng-model="MyData.Quarter" ng-options="obj.value as obj.text for obj in MyData.QuarterArray">
<option value="">Please select...</option>
</select>
<div>Quarter Selected: {{MyData.Quarter}}</div>
</div>
<p>What must I change to make this work in the latest AngularJS 1.*?</p>
</div>
CSS
</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ --> <link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css"> <script src="https://code.angularjs.org/1.4.2/angular.min.js"></script>
JavaScript
function QuarterController($scope) {
$scope.MyData = {
Quarter: 2,
QuarterArray: [{
'value': 1,
'text': 'Q1'
}, {
'value': 2,
'text': 'Q2'
}, {
'value': 3,
'text': 'Q3'
}, {
'value': 4,
'text': 'Q4'
}],
};
}
angular.module('myApp', []).controller('QuarterController', QuarterController);