0

I want to use ui-select, but it is not displaying anything and there are no errors in the developer console. I've been googling this for a few hours now and I've tried all the suggestions I've found, but nothing has helped.

I use Chrome and I've included Bootstrap version 3.3.4 and Angular version 1.4.8 in my SPA project. I've also included the latest versions of select.min.css and select.min.js. I added ui-select (version 0.19.5) to my project through NuGet in Visual Studio 2015.

I've reduced my code to a very simple example while trying to isolate the problem. Here is what I have right now (this is in my view):

<div id="damageType" name="damageType" class="col-md-4">
    <ui-select ng-maxlength="10">

        <ui-select-choices repeat="f in ['light','hpexp']">
            {{ f }}
        </ui-select-choices>
    </ui-select>
</div>

I've tried adding a ng-hide, like so, to no avail:

<div id="damageType" name="damageType" class="col-md-4">
    <ui-select ng-maxlength="10">

        <ui-select-choices repeat="f in ['light','hpexp']" ng-hide="!$select.open">
            {{ f }}
        </ui-select-choices>
    </ui-select>
</div>

Here is what it looks like in the page. The div where the drop-down should be displayed is there, but it's height is 1. Also, as you can see, there are no errors in the console:

ui-select not displaying

What could be the problem here?

1 Answer 1

1

Hi I think you are missing two things.

  1. The ui-select needs a ngModel so define this ng-model='selectedvalue'
  2. Second I believe it needs a ui-select-match as this is needed for the transclusion

The code below should work:

<ui-select ng-model="ctrl.selected">
 <ui-select-match placeholder="Enter an thing...">{{$select.selected}}</ui-select-match>
 <ui-select-choices repeat="item in ['1','2']">
  <span>{{item}}</span>
</ui-select-choices>

Sign up to request clarification or add additional context in comments.

Comments

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.