Angular: options array 1.0rc3

http://angularjs.org/

by zdam

HTML

<script src="http://code.angularjs.org/angular-1.0.0rc3.js"></script>
<div ng-controller="MyCtrl">
    Hello, {{name}}!
    <br/>
    {{theMonth}} 
    <br/>
    {{theBoop}}    
    <br/>
    {{theFruit}}
    <br/>
    {{theBlah}}
    <br/>
    
    
    ***** YOU HAVE TO SET NG-MODEL for NG-OPTIONS to work!
    
    <br/>
    <select ng-model="theMonth" ng-options="month for month in selList"></select>
    
    <br/>
    <select ng-model="theBoop" ng-options="fruit for fruit in objList"></select> <!-- need to pick a part of the object to display, eg fruit.text or fruit.value -->      
    <br/>
    <select ng-model="theFruit" ng-options="fruit.text for fruit in objList"></select>    
    <br/>
    <select ng-model="theBlah" ng-options="fruit as fruit.text for fruit in mvcSelectList"></select>
</div>

JavaScript

var myApp = angular.module('myApp',[]);

//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});

function MyCtrl($scope) {
    $scope.name = 'Superhero';
    
    $scope.theMonth = 'Feb';
    $scope.theBlah = {text:'Banana', value:'bnn'};
    //$scope.theFruit = {text:'Banana'};
    $scope.theFruit = 'Banana';
    
    $scope.selList=['Jan','Feb','Mar','Apr'];  
    
    $scope.objList = [{text:'Apple'},{text:'Banana'},{text:'Orange'}];
    
    
    $scope.mvcSelectList = [{text:'Apple', value:'apl'},{text:'Banana', value:'bnn'},{text:'Orange', value:'org'}];
}