Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ui-select : set width in Bootstrap grid system

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.

like image 269
user1260928 Avatar asked Jan 30 '15 15:01

user1260928


1 Answers

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>
like image 137
István Békési Avatar answered Oct 03 '22 00:10

István Békési