我的代码如下:
<select ng-model="testV" ng-change="change()">
<option value="">Any</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
如何让selected的选项设置为value等于$scope.testV的项呢?
淡淡烟草味2017-05-15 17:11:49
Add this sentence$scope.testV = 2;
to the controller and it will display 2 by default.
$scope.change = function(){
console.log($scope.testV);
}
In this way, every time the select value is changed, the console will output the changed value.