angular中的ng-options 用法

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="../js/angular-1.3.0.js" ></script>
</head>
<body>
<div ng-app="hd" ng-controller='ctrl'>
<select ng-options=" v.value as v.name for v in data" ng-model="city">
<option value=''>请选择</option>
</select>
{{city}}
</div>
<script>
var m = angular.module('hd',[]);
m.controller('ctrl',['$scope',function($scope){
$scope.city='qing hua'; //默认选中
$scope.data=[{name:'北大',value:'bei da'},{name:'清华',value:'qing hua'},{name:'南开',value:'nankai'}];
}]);
</script>
</body>
</html>

原文地址:https://www.cnblogs.com/qiyc/p/6965191.html