Search code examples
angularjsbootstrap-4

AngularJS with ui-select error - Error: [ui.select:transcluded] Expected 1 ui-select-matchbut got 0


<div class="form-group">
    <label class="control-label"> Ticket Closure Type </label>
    <ui-select ng-model="resCode" theme="bootstrap"
               ng-click="vm.getClosureTypeOfCloseTicket(resCode)">
        <ui-select-choices ng-repeat="resolutionCode in resolutionCodes | filter: $select.search">
           {{resolutionCode.csmClosureReasonCode}}
        </ui-select-choices>
    </ui-select>

    <!-- <select ng-model="resCode" on-select="vm.getClosureTypeOfCloseTicket(resCode)">
        <option repeat="resolutionCode in resolutionCodes">{{resolutionCode.csmClosureReasonCode}}</option>
    </select> -->

</div>

The code piece I commented out is working as intended. On the other hand when I want to use ui-select, it gives the error below.

Error: [ui.select:transcluded] Expected 1 ui-select-match but got 0


Solution

  • you have to append ui-select-match directive to ui-select.

    <ui-select-match placeholder="Select person...">{{$item.name}} &lt;{{$item.email}}&gt;</ui-select-match>
    

    add something like above according to your need.