Select2 Bootstrap Angularjs

Asked

Viewed 106 times

1

Does anyone use the Select2 Bootstrap in Angularjs? I have a problem... when I click on the drop-down list (options) displays the correct value that comes from the bank, but in the view always appears the first record. When shooting Select2 works normal.inserir a descrição da imagem aqui

  • Please enter some of the code

1 answer

1


I don’t know exactly what your code is, but I use it this way:

<select chosen="chosen.options" id="especialidade" ng-model="specialty" no-results-text="chosen.empty" class="form-control">
      <option selected ng-click="search(true, false)">{{chosen.specialty}}</option>
      <option ng-repeat="item in specialties" value="{{item.name}}" ng-click="search(true, false)">{{item.name}}</option>
</select>

This first option I put Selected and my interpolation is a default "Select" text. The second option is where I will go through my specialty options.

In my case, when clicking on one of the specialties I have an ng-click that does an action, if you just want to list you don’t need to use ng-click.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.