<div ng-app="myApp" ng-controller="myCtrl">
<select ng-model="selectedName" ng-options="item.id as item.name for item in names">
//item.id这个部分是设置value,item.name这个部分是设置label的属性值,names为下方的names,这个类似foreach
<option value="">123</option>
</select>
<input value="123" type="button" ng-click="ff()">
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function ($scope) {
$scope.names = [{name: "aaaa", id: "1"},
{name: "bbbb", id: "2"},
{name: "ccc", id: "3"}];
$scope.ff = function () {
//取值
alert($scope.selectedName);
}
});
</script>
请看以上代码