angular-ui / ui-select2

AngularJS wrapper for select2 (deprecated, use angular-ui/ui-select)
https://github.com/angular-ui/ui-select
MIT License
595 stars 444 forks source link

Empty <option> shows 2 empty fields in angular 1.4.8 #296

Open Vayvala opened 8 years ago

Vayvala commented 8 years ago

I am using angular-ui-select for dropdowns. I need to have dropdown that you can cancel.

Here is my dropdown in template:

<select ui-select2="select2Options" name="Machine" ng-model="selectedMachine.type" data-placeholder="type" required>
    <option value=""></option>
    <option ng-repeat="type in machineTypes" value="{{type}}">{{type}}</option>
</select>

Here is select2Options:

$rootScope.select2Options = {
  minimumResultsForSearch: 5,
  allowClear: true,
  ...
}

Here is the result:
enter image description here enter image description here

As you can see, there is a cancel button (and it works), but something weird happens on the picture to the left. Cause of the <option value=""></option> there are two empty fields that you can check.

If you delete <option value=""></option>, weird empty fields disappear, however there is no cancel button either:
enter image description here

angular: v1.4.8 angular-ui-select2: v0.0.5 select2: v3.4

hungyc commented 8 years ago

Same issue, any solutions?