即使我们选择了已选择的值
,是否还有其他事件可以获得select值var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {
$scope.sizes = [ {code: 1, name: 'n1'}, {code: 2, name: 'n2'}];
$scope.update = function() {
console.log('updated')
}
}
答案 0 :(得分:0)
试试这段代码
<div ng-controller="MyCtrl">
<select name="abc" ng-model="item" ng-change="update(item)" >
<option value="">Select</option>
<option name="age" ng-value="{{size.code}}" ng-repeat="size in sizes"
value="{{size.code}}" >
{{size.name }}
</option>
</select>
{{item.code}} {{item.name}}
</div>
控制器
var myApp = angular.module('myApp',[]);
//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});
function MyCtrl($scope) {
$scope.sizes = [ {code: 1, name: 'n1'}, {code: 2, name: 'n2'}];
$scope.update = function(item) {
alert(item)
}
}