ng-repeat && ng-options的故事

ng-repeat && ng-options的故事
 

 1.

<select class="input-small" ng-model="newHost.os"

               style="102px;" ng-show="osType==2">
                <option ng-repeat="item in osList.Linux" value="{{item.id}}">{{item.name}}</option>
 </select>
 
 
2.为了觉得ie8的兼容性问题请用这一款!
<select class="input-small" ng-model="newHost.os"  style="102px;" ng-show="osType==2" ng-options="item.id as item.name for item in osList.Linux" ng-init="osList.Linux[0].id">
 </select> 
 
 
原文地址:https://www.cnblogs.com/direction/p/4727452.html