首页 > 代码库 > AngularJS select

AngularJS select

 1 @{ 2     ViewBag.Title = "Index"; 3 } 4  5 <script type="text/javascript"> 6     var myappModule = angular.module(myapp, []); 7     myappModule.controller(selectCtr, function ($scope) { 8         $scope.selectLst = [{ name: , value: 1 }, { name: , value: 2 }, { name: , value: 3 }]; 9         $scope.show = function () {10             alert($scope.selected);11         };12     });13 </script>14 15 <div ng-app="myapp" ng-controller="selectCtr">16     <select ng-model="selected" ng-options="p.value as p.name for p in selectLst" ng-change="show()">17         <option value="">选择下列数据</option>18     </select>19 </div>


获取selected的数据