Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Angular 1.5 - Uncaught Error: [ui.select:transcluded] Expected 1 .ui-select-match but got '0'. #1444

Closed
mikemclin opened this issue Feb 17, 2016 · 25 comments

Comments

@mikemclin
Copy link

Code broken when I upgraded from Angular 1.4 to 1.5 Now I get the following error:

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

Looks like I'm not the only one running into the issue (look at the last comment) - #71.

@mikemclin
Copy link
Author

Actually b1c4fdc fixes this issue.

Waiting on a release.

@rodmax
Copy link

rodmax commented Feb 17, 2016

+1 to quickly release this :) because it is blocker to bump angular 1.5.x

@ConsultDarryl
Copy link

+1 for a quick release :) Testing the changes in local environment but would prefer the official build.

@misaizdaleka
Copy link

+1

5 similar comments
@bwereszczak
Copy link

+1

@Mo7medFouad
Copy link

+1

@gino8080
Copy link

+1

@Azsael
Copy link

Azsael commented Feb 18, 2016

+1

@armanforghani
Copy link

+1

@Narretz
Copy link
Contributor

Narretz commented Feb 18, 2016

@aaronroberson wdyt about a quick patch release that includes the 1.5. fix?

@aaronroberson
Copy link
Contributor

#1430 has been included in the v0.14.3 release.

@Sixthdim
Copy link

Hmm, I'm still getting the Expected 1 .ui-select-match but got '0'. error in 0.14.3 and Angular 1.5.

@aaronroberson
Copy link
Contributor

@Sixthdim Can you provide a stack trace, any additional details or plunkr example?

@Sixthdim
Copy link

@aaronroberson Sure, here is the stack. I'll see if I can get a fiddle up today if this doesn't help.

angular.js:13236 Error: [ui.select:transcluded] Expected 1 .ui-select-match but got '0'.
    at http://localhost:8080/js/select.js:125:12
    at http://localhost:8080/js/select.js:1038:19
    at publicLinkFn (http://localhost:8080/js/angular.js:8105:29)
    at http://localhost:8080/js/angular.js:8447:29
    at boundTranscludeFn (http://localhost:8080/js/angular.js:8244:16)
    at controllersBoundTransclude (http://localhost:8080/js/angular.js:9020:20)
    at http://localhost:8080/js/select.js:1026:9
    at invokeLinkFn (http://localhost:8080/js/angular.js:9492:9)
    at nodeLinkFn (http://localhost:8080/js/angular.js:8978:11)
    at http://localhost:8080/js/angular.js:9231:13 <div class="ui-select-container selectize-control single ng-pristine ng-untouched ng-valid ng-scope" ng-class="{'open': $select.open}" ng-model="sort.currentSort" theme="selectize" id="result-sort" <ui-select-match="">(anonymous function) @ angular.js:13236(anonymous function) @ angular.js:9965(anonymous function) @ app.errors.js:28invokeLinkFn @ angular.js:9494nodeLinkFn @ angular.js:8978(anonymous function) @ angular.js:9231processQueue @ angular.js:15552(anonymous function) @ angular.js:15568Scope.$eval @ angular.js:16820Scope.$digest @ angular.js:16636Scope.$apply @ angular.js:16928(anonymous function) @ angular.js:18753completeOutstandingRequest @ angular.js:5804(anonymous function) @ angular.js:6081nrWrapper @ newrelic.js:2

angular.js:13236 TypeError: Cannot read property 'source' of undefined
    at Array.<anonymous> (http://localhost:8080/js/select.js:1672:40)
    at ngModelWatch (http://localhost:8080/js/angular.js:26467:36)
    at Scope.$digest (http://localhost:8080/js/angular.js:16655:34)
    at Scope.$apply (http://localhost:8080/js/angular.js:16928:24)
    at http://localhost:8080/js/angular.js:18753:36
    at completeOutstandingRequest (http://localhost:8080/js/angular.js:5804:10)
    at http://localhost:8080/js/angular.js:6081:7
    at nrWrapper (http://localhost:8080/js/newrelic.js:2:12781) undefined

@aaronroberson
Copy link
Contributor

Cannot read property 'source' of undefined at Array. (http://localhost:8080/js/select.js:1672:40)

@Narretz can you reproduce after upgrading to v0.14.3?

@Azsael
Copy link

Azsael commented Feb 18, 2016

@aaronroberson I am getting same as @Sixthdim when I upgrade.

@Narretz
Copy link
Contributor

Narretz commented Feb 18, 2016

@aaronroberson Here's the demo modified with latest angular and ui-select versions, and all things work: http://plnkr.co/edit/ZAncjGXEZvyMJCM3eKew?p=preview
If anyone is still experiencing the error, then you should post a demo of the problem in the plnkr. There are maybe edge cases that this fix didn't catch. The test coverage is also not that good, and I only made it so that all tests pass, I didn't investigate deep into complex setups.

@Azsael
Copy link

Azsael commented Feb 18, 2016

@Narretz Looks like the 0.14.3 package which I installed via npm, still has the old 0.14.1 files in the dist folder even though package indicated it was 0.14.3

@Narretz
Copy link
Contributor

Narretz commented Feb 18, 2016

@Azsael Thanks for investigating. This is something @aaronroberson must handle ;)

@aaronroberson
Copy link
Contributor

If you look here you'll see the tag for v0.14.3 has the updated build files. Something may have gone wrong when publishing to npm.

@Azsael
Copy link

Azsael commented Feb 18, 2016

@aaronroberson Not quite sure, I noticed you released more versions so updated to 0.14.7

@ivanaradojevic
Copy link

@Narretz I'm still getting this issue, in case of having huge list. Here is the updated Plunker, with updated ui-select version as well: http://plnkr.co/edit/GZRDGUGe5UIlvBVz8YDv?p=preview

So the problem is when large amount of data needs to be loaded in the dropdown, if you click second time while ui-select tries to execute functions from the first request, it will return the same error in the console and it will block the dropdown.

Is there something else that needs to be extra configured for this case?

@soichih
Copy link

soichih commented Sep 15, 2016

+1

Seeing following error message.

Error: [ui.select:transcluded] 
http://errors.angularjs.org/1.5.0/ui.select/transcluded?p0=Expected%201%20.ui-select-match%20but%20got%20'%7B0%7D'.&p1=0

From

          var transcludedMatch = transcluded.querySelectorAll('.ui-select-match');
          transcludedMatch.removeAttr('ui-select-match'); //To avoid loop in case directive as attr
          transcludedMatch.removeAttr('data-ui-select-match'); // Properly handle HTML5 data-attributes
          if (transcludedMatch.length !== 1) {
            throw uiSelectMinErr('transcluded', "Expected 1 .ui-select-match but got '{0}'.", transcludedMatch.length);
          }
          element.querySelectorAll('.ui-select-match').replaceWith(transcludedMatch);

It looks like transcluded.querySelectorAll('.ui-select-match') is returning empty.

@naresh217
Copy link

I am still have issue with latest ui-select and angular 1.5 or 1.6

var app = angular.module('demo', ['ngSanitize', 'ui.select']);
app.run(["$templateCache",function($templateCache){
var tmpl=`<div class="ui-select-container ui-select-multiple ui-select-bootstrap dropdown
         form-control" ng-class="{open: $select.open}">
    <div ng-if="true">
        <div class="ui-select-match"></div>
        <input custom-directive enable-format="{{$ctrl.enableMobileNumberFilter}}" type="search" autocomplete="off" autocorrect="off" autocapitalize="off"
               spellcheck="false" class="ui-select-search input-xs"
               placeholder="{{$selectMultiple.getPlaceholder()}}" ng-disabled="$select.disabled"
               ng-click="$select.activate()" ng-model="$select.search" role="combobox" aria-expanded="{{$select.open}}"
               aria-label="{{$select.baseTitle}}" ng-class="{'spinner': $select.refreshing}" ondrop="return false;">
    </div>
    <div class="ui-select-choices"></div>
    <div class="ui-select-no-choice"></div>
</div>`
 $templateCache.put("bootstrap/select-multiple.tpl.html",tmpl);
    }])

I have just added ng-if ="true" (eventually this will replace with actual condition). But it is throwing me an error "Expected 1 input.ui-select-search but got '0'"

It works just fine once we remove ng-if.

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

@taneljoeaar
Copy link

I got this error because my ui-select tag was not closed properly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests