【发布时间】:2017-05-27 01:57:24
【问题描述】:
我想使用 Angular JS 动态更改下拉列表控件的选择项,但它不会更改视图。 我试过this one,但还没有结果!
控制器:
$scope.dischargeType = {id:0,title:''};
$scope.setSelect = function() {
debugger;
$scope.dischargeType = $scope.dischargeTypes[1];
alert($scope.dischargeType.title);
// it shows that the $scope.operationType get the value,but no changes on html
}
查看:
<label class="col-sm-3 control-label">Discharge Type</label>
<div class="col-sm-9">
<select ui-select2 data-ng-model="dischargeType" id="add-dischargeType" name="dischargeType">
<option data-ng-repeat="item in dischargeTypes" value="{{item.id}}">{{item.title}}</option>
</select>
</div>
真的谢谢你。
【问题讨论】:
标签: javascript angularjs