前言碎语
使用angular肯定都知道ng的双向数据绑定特性,有像有点废话,但是,今天博主在处理省市下拉框联动数据回显的时候这种特性失效了,同样的下拉框,有的又有用,作为非专业前端博主一脸懵逼,不过,最后用ng-selected还是完美解决了回显的问题,做个记录
代码如下:
代码语言:javascript复制 <div class="col-xs-4 p0 pb10">
<div class="input-group input-group-sm ig9">
<span class="ig2 input-group-addon" style="width: 25%;">所属省</span>
<select class="form-control" ng-model="app.insProvinceName" ng-disabled="app.disabled"
ng-change="changWithCity(app.insProvinceName)">
<option value="">未选择</option>
<option ng-repeat="m in prinMap" value="{{m.prinCode}}" ng-selected="app.insProvinceName==m.prinCode">{{m.prinName}}</option>
</select>
</div>
</div>
<!---->
<div class="col-xs-4 p0 pb10">
<div class="input-group input-group-sm ig9">
<span class="ig2 input-group-addon" style="width: 25%;">所属市</span>
<select class="form-control" ng-model="app.insCityName" ng-disabled="app.disabled">
<option value="">未选择</option>
<option ng-repeat="m in bankgWithCity.cityMap" value="{{m.cityCode}}" ng-selected="app.insCityName==m.cityCode">{{m.cityName}}</option>
</select>
</div>
</div>