案例:AngularJS案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<meta charset="utf-8">
5
<script src="/js/angular.js1.4.6/angular.min.js"></script>
6
</head>
7
<body>
8
9
<div ng-app="myApp" ng-controller="myCtrl">
10
11
<p>选择一辆车:</p>
12
13
<select ng-model="selectedCar" ng-options="x for (x, y) in cars">
14
</select>
15
16
<h1>你选择的是: {{selectedCar.brand}}</h1>
17
<h2>模型: {{selectedCar.model}}</h2>
18
<h3>颜色: {{selectedCar.color}}</h3>
19
20
<p>注意选中的值是一个对象。</p>
21
</div>
22
23
<script>
24
var app = angular.module('myApp', []);
25
app.controller('myCtrl', function($scope) {
26
    $scope.cars = {
27
        car01 : {brand : "Ford", model : "Mustang", color : "red"},
28
        car02 : {brand : "Fiat", model : "500", color : "white"},
29
        car03 : {brand : "Volvo", model : "XC90", color : "black"}
30
    }
31
});
32
</script>
33
34
</body>
35
</html>
36