为了账号安全,请及时绑定邮箱和手机立即绑定

angular ng-model 绑定的值不更新

angular ng-model 绑定的值不更新

梦里花落0921 2018-08-06 11:10:59
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是数组的一个值,相当于常量?求详细解答

1 回答

?
慕桂英3389331

TA贡献2036条经验 获得超8个赞

selectedSlot 换成对象格式:
selectedSlot.someAttr

查看完整回答
反对 回复 2018-09-20

添加回答

代码语言

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号