解決設置select默認選中不生效的方法


$scope.storageTypeList = ['Glusterfs','NFS','Ceph'];

不生效的方法:

        <select class="form-control" name="type" ng-disabled="editStorage.usage !== null" required
                data-ng-model="storageVO.type">
          <option value="{{storageType}}" data-ng-repeat="storageType in storageTypeList">{{storageType}}</option>
        </select>
$scope.storageVO.type ='NFS';

 

生效的方法

        <select class="form-control" name="type" ng-disabled="editStorage.usage !== null" required
                data-ng-model="storageVO.type">
          <option value="{{storageType}}" ng-selected="storageType === storageVO.type"
                  data-ng-repeat="storageType in storageTypeList">{{storageType}}</option>
        </select>
$scope.storageVO.type ='NFS';

主要是紫色字體部分產生的作用


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM