ui-select:在Bootstrap网格系统中设置宽度

时间:2015-01-30 15:33:01

标签: twitter-bootstrap-3 ui-select

我在bootstrap网格中有一个带有ui-select的表单。 我希望我的ui-select与它下面的输入一样宽。 这是我的代码

<div class="col-md-12">
   <div class="col-md-6 form-group">
        <label class="col-md-4" style="text-align:right;">Pays</label>
        <div class="col-md-8">
            <ui-select ng-model="adresse.pays" theme="select2" ng-disabled="disabled" ame="pays">
                <ui-select-match placeholder="Sélectionnez un pays..." allow-clear>{{$select.selected.nom}}</ui-select-match>
                <ui-select-choices repeat="pays in payss | propsFilter: {nom : $select.search}">
                    <div ng-bind-html="pays.nom | highlight: $select.search"></div>
                </ui-select-choices>
            </ui-select>
        </div>
    </div>
    <div class="col-md-6">
        <label class="col-md-4" style="text-align:right;">Mail</label>
        <input type="text" class="col-md-3 input-sm"
            ng-model="adresse.mail">
    </div>
</div>
<div class="col-md-12">
    <div class="form-group col-md-6">
        <label class="col-md-4" style="text-align:right;">Code adresse client</label>
        <input type="text" class="col-md-8 input-sm"
            ng-model="adresse.codeAdresseClient" name="codeAdresse">
    </div>
    <div class="form-group col-md-6">
        <label class="col-md-4" style="text-align:right;">Interlocuteur</label>
        <input type="text" class="col-md-3 input-sm"
            ng-model="adresse.interlocuteur" name="interlocuteur">
    </div>
</div>  

此代码生成: enter image description here

如果有人知道该怎么做...... 提前谢谢。

2 个答案:

答案 0 :(得分:5)

我的建议是

  • 使用bootstrap主题(而不是select2)或
  • 只需将宽度设置为100%

检查此插件:http://plnkr.co/edit/9mI8nO?p=preview

<ui-select ng-model="person.selected" theme="bootstrap">
  ...
</ui-select>

<ui-select ng-model="person.selected" theme="select2" style="width:100%">
  ...
</ui-select>

答案 1 :(得分:1)

.ui-select-multiple input.ui-select-search {
     width: auto !important;
}