猿问

angular ng-model 绑定的值不更新

angular ng-model 绑定的值不更新

代码主要部分如下

// html代码<div class="form-group">
  <label>Slot : </label>
  <select class="form-control" ng-model="selectedSlot" ng-options="slot for slot in slotlist"></select>
</div>//javascript代码$scope.slotlist = ['Flash Ads', 'Native Ads', 'Lock Ads'];
$scope.selectedSlot = $scope.slotlist[0];

如代码所示,为什么我改变下拉框的值时,$scope.selectedSlot 并没有动态改变?
是不是因为$scope.selectedSlot是数组的一个值,相当于常量?

求详细解答


梦里花落0921
浏览 1577回答 1
1回答

慕桂英3389331

selectedSlot 换成对象格式:selectedSlot.someAttr
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答