angularjs ui-select如何设置默认选中值

angularjs ui-select如何设置默认选中值,可以采用ng-model来设置,示例如下:

            <div class="col-sm-6">
 
                  <ui-select ng-model="provinces.selected" theme="bootstrap"
 
                        on-select="loadCitys($item, $model)"> <ui-select-match
 
                        placeholder="选择省份">{{$select.selected.name}}</ui-select-match> <ui-select-choices
 
                        repeat="province in provinces  | filter: $select.search">
 
                    <div ng-bind-html="province.name | highlight: $select.search"></div>
 
                    </ui-select-choices> </ui-select>
 
                </div>

只要设置了 ng-model并设置它的值 ,就可以出来默认选 中了。


版权声明:本文为lengyuewusheng99原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。