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的数据
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。