5

I have a form with a ui-select in a bootstrap grid. I want my ui-select to be as wide as the input below it. Here is my code

<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>  

This code produces this: enter image description here

If someone knows how to do that... Thanks in advance.

user1260928
  • 3,269
  • 9
  • 59
  • 105

2 Answers2

5

My suggestion is to either

  • use bootstrap theme (instead of select2), or
  • simply set width to 100%

Check this plunk: 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>
István Békési
  • 993
  • 4
  • 16
  • 27
1
.ui-select-multiple input.ui-select-search {
     width: auto !important;
}
Ahmad R. Nazemi
  • 775
  • 10
  • 26