答案 0 :(得分:0)
这是一个简单的例子。
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.opts = [
{text : "daily", value : "days"},
{text : "weekly", value : "weeks"},
{text : "monthly", value : "months"}
];
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<select ng-model="selectedName" ng-options="x.text for x in opts">
</select>
<h1>You selected: {{selectedName.value}}</h1>
</div>