Popularni postovi

Wednesday, 9 July 2014

Select/Dropdown/Combobox controls in angular

These days I tried a lot of select/Dropdown/Combobox controls in angular but on the end I realized that classic select2 (angular version) works best.
Here is link to ui-select2: https://github.com/angular-ui/ui-select2 
After you implenet it you will see that it doesn't look in bootstrap style so you should download aditional css for select2: http://fk.github.io/select2-bootstrap-css/index.html

in your code you need to add this files:

 <link href="content/css/select2/select2.css" rel="stylesheet" />
    <link href="content/css/select2/select2-bootstrap.css" rel="stylesheet" />


    <script src="scripts/select2.min.js"></script>
    <script src="scripts/select2.js"></script>



Here is example:

 <select class="select2-container form-control select2" ui-select2 ng-model="New.opcinaID" data-placeholder="Pick a number" ng-required="true">
                                    <option value=""></option>
                                    <option ng-repeat="kontakt in kontakti" value="{{kontakt.id}}">{{kontakt.naziv}}</option>
                                </select>

1 comment:

  1. works very well, appreciate your tutorial as well as effort !

    ReplyDelete