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是数组的一个值,相当于常量?
求详细解答
selectedSlot 换成对象格式:
selectedSlot.someAttr