Ui-select will not focus input element on first click with ngAnimate

The problem is that when you have ui-select in an angular project that uses ngAnimate and click on it to enter something, you cannot enter it until you click on the input element a second time, Basically, it seems that the focus is on the second click.

This seems to be a problem with the bootstrap theme and the lack of items in the list.

http://plnkr.co/edit/jqXDJLN33U75EO9imGER?p=preview

  <ui-select ng-model="country.selected" theme="bootstrap" ng-disabled="disabled" style="width: 300px;">
    <ui-select-match placeholder="Select or search a country in the list...">{{$select.selected.name}}</ui-select-match>
    <ui-select-choices repeat="country in countries | filter: $select.search">
      <span ng-bind-html="country.name | highlight: $select.search"></span>
      <small ng-bind-html="country.code | highlight: $select.search"></small>
    </ui-select-choices>
  </ui-select>

var app = angular.module('selectizeDemo', [
  'ngAnimate',
  'ngSanitize', 
  'ui.select'
  ]);

app.controller('MainCtrl', function($scope) {

    $scope.countries = [];

  /*$scope.countries = [ 
    {name: 'Afghanistan', code: 'AF'},
    {name: 'Åland Islands', code: 'AX'},
    {name: 'Albania', code: 'AL'},
    {name: 'Algeria', code: 'DZ'},
    {name: 'American Samoa', code: 'AS'},
    {name: 'Andorra', code: 'AD'},
    {name: 'Angola', code: 'AO'},
    {name: 'Anguilla', code: 'AI'},
    {name: 'Antarctica', code: 'AQ'},
    {name: 'Antigua and Barbuda', code: 'AG'}];*/
});

As you can see, if you add items to the list or change the theme for selection, it works as intended.

Is there any way around this?

+4
source share

All Articles