你能告诉我为什么 ng-change
在 angularjs 中给出“undefined”吗?
$scope.onChangedCityDropDown= function(i){
console.log(i)
}
<select class="form-control" ng-model="a"
ng-options="item.city as item.city for item in vals"
ng-change="onChangedCityDropDown(item)">
<option value="" disabled>choose an option</option>
</select>
最佳答案
您可以直接将 ng-model 值传递给函数,
<select class="form-control" ng-model="a" ng-options="item.city as item.city for item in vals" ng-change="onChangedCityDropDown(a)">
<option value="" disabled>choose an option</option>
</select>
关于javascript - 为什么 ng-change 在 angularjs 中给出 "undefined"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53167539/