3

I'm trying to use angular ui-select in my project but somehow the css is not working properly.

index.html:

  <link rel="stylesheet" href="bower_components/bootstrap-social/bootstrap-social.css" />
  <link rel="stylesheet" href="bower_components/angularjs-slider/dist/rzslider.css" />
  <link rel="stylesheet" href="bower_components/angular-dropdowns/dist/angular-dropdowns.css" />
  <link rel="stylesheet" href="bower_components/angular-loading-bar/build/loading-bar.css" />
  <link rel="stylesheet" href="bower_components/textAngular/dist/textAngular.css" />
  <link rel="stylesheet" href="bower_components/perfect-scrollbar/src/perfect-scrollbar.css" />
  <link rel="stylesheet" href="bower_components/fullcalendar/dist/fullcalendar.css" />
  <link rel="stylesheet" href="bower_components/angularjs-toaster/toaster.css" />
  <link rel="stylesheet" href="bower_components/ngprogress/ngProgress.css" />
  <link rel="stylesheet" href="bower_components/angular-ui-select/dist/select.css" />
  <script src="bower_components/ng-file-upload-shim/ng-file-upload-shim.js"></script>
  <script src="bower_components/perfect-scrollbar/src/perfect-scrollbar.js"></script>
  <script src="bower_components/angular-perfect-scrollbar/src/angular-perfect-scrollbar.js"></script>
  <script src="bower_components/moment/moment.js"></script>
  <script src="bower_components/fullcalendar/dist/fullcalendar.js"></script>
  <script src="bower_components/angular-ui-calendar/src/calendar.js"></script>
  <script src="bower_components/angularjs-geolocation/src/geolocation.js"></script>
  <script src="bower_components/angularjs-toaster/toaster.js"></script>
  <script src="bower_components/ngprogress/build/ngProgress.js"></script>
  <script src="bower_components/angular-ui-select/dist/select.js"></script>

Package versions:

Angularjs: 1.4.5 
ui-bootstrap: 0.11.2 
Angular ui-select: 0.12.1

html file:

<ui-select ng-model="stream.selected" theme="select2" ng-disabled="disabled" style="min-width: 300px;">
  <ui-select-match placeholder="Select a social profile in the list">{{$select.selected.name}}</ui-select-match>
  <ui-select-choices repeat="profile in socialNetworks  | filter: $select.search">
    <div ng-bind-html="profile.name | highlight: $select.search"> </div>
  </ui-select-choices>
</ui-select>

controller.js

'use strict';

angular.module('myApp')
    .controller('AddStreamPopUpCtrl', function ($scope, $modalInstance, $state, socialNetworks, $modal) {

      $scope.close = function () {
        $modalInstance.dismiss('close');
      };

      $scope.cancel = function () {
        $modalInstance.dismiss('cancel');
      };

      $scope.redirect = function() {
        $state.go('dashboard.mailbox.inbox');
        $modalInstance.dismiss('close');
      };

          $scope.socialNetworks = [{name:'test', value: 'someVal'}];
    });

The result of above code looks something like:

enter image description here

Can anyone give pointers why is this not loading css properly ?

dark_shadow
  • 3,503
  • 11
  • 56
  • 81

1 Answers1

5

Plunker example modified to not downloading 'select2.css'.

Try

<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/select2/3.4.5/select2.css">
bob
  • 2,674
  • 1
  • 29
  • 46
  • Thanks Bob that worked for me :) Though I can still see some issues if I use select2#4.0.0 See this http://plnkr.co/edit/9RmB8aGddne6Ypy0dKBe?p=preview – dark_shadow Sep 05 '15 at 08:08
  • @dark_shadow I wonder you have particular reason to use 4.0.0 rather than 3.4.5? – bob Sep 05 '15 at 10:53
  • Well I just picked initially the latest version by default. Later on found that it is not compatible so picked 3.4.5. Anyways, I think they will soon make it compatible with the latest version. I have updated one issue on their github page for same. Thanks for your help :) – dark_shadow Sep 05 '15 at 12:56
  • @bob Hi, I'm having the same issue but I'm using the select2-rails gem 3.5. Do you know if this issue is still outstanding? I thought that an older version of select2 would work? I'm using ui-select 0.12.x. – JCC Dec 04 '15 at 22:50