扫码关注官方订阅号
就是option改了之后,我在控制器里用$scope.name取不到值,好奇怪
光阴似箭催人老,日月如移越少年。
https://code.angularjs.org/1....
<select name="mySelect" id="mySelect" ng-options="option.name for option in data.availableOptions track by option.id" ng-model="data.selectedOption"></select>
http://codepen.io/hj624608494...
<select ng-model="name" ng-change="showName()"> <option ng-repeat="item in items" ng-value="item" ng-bind="item"></option> </select>
app.controller('myCtrl', function($scope) { $scope.name = 1; $scope.items=[1,2,3]; $scope.showName=function(){ console.log($scope.name); } });
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
https://code.angularjs.org/1....
http://codepen.io/hj624608494...