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 ?

4
  • What theme are you using? Commented Sep 4, 2015 at 19:22
  • It's not working for any of the themes. Somehow my html was not appearing in the question earlier..updated that Commented Sep 4, 2015 at 19:25
  • You are not downloading select2.css. Try to use 'select2' theme as shown in multiselect example. Commented Sep 4, 2015 at 19:31
  • Can you please share that example ? It'll be great Commented Sep 4, 2015 at 19:42

1 Answer 1

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">
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks Bob that worked for me :) Though I can still see some issues if I use select2#4.0.0 See this plnkr.co/edit/9RmB8aGddne6Ypy0dKBe?p=preview
@dark_shadow I wonder you have particular reason to use 4.0.0 rather than 3.4.5?
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 :)
@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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.