AngularJS select

时间:2014-08-08 15:38:56   收藏:0   阅读:254
 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的数据

AngularJS select,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!