-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Getting Error: [ui.select:transcluded] Expected 1 .ui-select-match but got '0'. #224
Comments
pls help |
I opened the plunker to refer to, but works ok. Can you tell me how to reproduce that error? |
I have the same issue . My use-case is that I'm attempting to include the match and choices via a second directive, similar to this: http://plnkr.co/edit/9IZ0aW?p=preview |
v1.2.26 all is ok |
with angular > 1.3 the problem is back again |
I get this error when I am trying to use a custom (Bootstrap based) theme. Is it possible to wrap the template calls into a single promise? |
+1 |
I have found it quite easy to reproduce the |
My workaround is to cache the templates myself inside of a var templatePath = uiSelectConfig.theme;
$scope.uiSelectTemplateReady = false;
$q.all([
$http.get(templatePath + '/choices.tpl.html', {cache: $templateCache}),
$http.get(templatePath + '/match-multiple.tpl.html', {cache: $templateCache}),
$http.get(templatePath + '/select-multiple.tpl.html', {cache: $templateCache})
])
.then(function (res) {
$scope.uiSelectTemplateReady = true;
return res;
}); |
This looks like a race issue here that occurs, particularly on first load and I have been trying to get to the bottom of it with no joy so far. Unfortunately none of the templateCache solutions mentioned have really worked. I can see the problem comes down to the number of transcludedMatch.length in this line of code "if (transcludedMatch.length !== 1) {" especially as ui-select-match is being used <ui-select ng-model="gender.selected" title="Gender" class="form-control cp-select" >
<ui-select-choices repeat="gender in genders | filter: $select.search">
<div ng-bind-html="gender | highlight: $select.search"></div>
</ui-select-choices>
<ui-select-match class="cp-select-question" placeholder="Gender"><span class="cp-select-question">{{$select.selected}}</span></ui-select-match>
</ui-select> It does not happen everytime, but if I test with private or incognito browsing its easier to reproduce. I am using the latest version of select-ui and angular 1.3.15 Any help here would be really appreciated. Thanks |
👍 same here, I'm also using another directive to compile ui-select html templates. |
I am using the work-around posted by @sime just extended to all ui-select templates: $scope.uiSelectTemplateReady = false;
var base = '...';
$q.all([
$http.get(base + '/choices.tpl.html', {cache: $templateCache}),
$http.get(base + '/match.tpl.html', {cache: $templateCache}),
$http.get(base + '/select.tpl.html', {cache: $templateCache}),
$http.get(base + '/match-multiple.tpl.html', {cache: $templateCache}),
$http.get(base + '/select-multiple.tpl.html', {cache: $templateCache})
])
.then(function (res) {
$scope.uiSelectTemplateReady = true;
return res;
}); |
I'm having the same issue here |
I tried the same as @arteme and @sime but this did not solve the problem for me. I made sure, that all templates had been loaded using the resolve feature ui-router. Additionally, I made the templates load one by one in the "correct order" (match, choices, select) for testing purposes. Same issues. So far, the only workaround that resolves the issue for me was adding all templates using a script tag to my document as @nasturah described here. |
@nasturah thanks for your workaround solution. I can able to append DOM elements inside ui-select templates. But i am facing one issue when i am trying to invoke function which is binded to element Ex: i added two DOM elements to select2/choice tmp and binded with ng-click and methods are defined inside controller.
the ng-click with methods add() & delete() fires twice :( |
Any traction on fixing this? |
I am also facing the same issue. It is 100% reproducible on my environment. The issue only happens when I use a mobile device (e.g. iPhone/iPad) or Chrome's mobile emulation view. When I debug deeper, it seems
The length of the choices is 0. After further digging, I noticed that it happens when ngTouch is enabled. If I disable ngTouch, the problem will be gone. This is caused by unexpected |
same error with 1.5.0 |
+1 |
1 similar comment
+1 |
Temporary fix mentioned here: #1325 by @llafuente "Add class to ui-select-match and ui-select-choices with the same name" |
+1 |
1 similar comment
+1 |
have the error sometimes with 1.4.8 |
@jziggas tried that but seems to be different for my problem. I experienced the same as @ftorghele
Problem gone, but performance is significantly worse on larger lists (257 rows), no problem on small lists. This happen when I upgraded to: Previously on my HTML in question `
` EDIT: |
It's clearly not compatible with angular 1.5, just opened the demo Plunker, replace angular 1.2.6 by angular 1.5 then get the same error .... http://plnkr.co/edit/wGniqjTA8KTc6uWG2uxr?p=preview The demo is working fine until angular 1.4.8. |
@ebuildy where did you get that We had to switch from the npm module |
Actually, even with version 0.17.1, I see the error if I omit:
This was my problem.... sorry for trouble |
@marcbachmann Updating angular-ui-select: |
@rasenplanscher , thanks . it's works . |
@rasenplanscher I'm still getting this error on angular 1.5.6 and angular-ui-select 0.18.0. Here's my code:
Can you please tell me what's wrong with it? UPDATE I found out that for
Not sure how this happens. UPDATE 2
For some reason, |
@refaelos An additional note: you do not need the "ui-select-match" class since 0.14.3 |
@rasenplanscher thanks. I'll get it fixed. |
This couple seems to be happy! 😍
|
Running Anguler 1.5 and angular-ui-select 0.19.1. Here's my CSS fix:
|
Note for those using npm to install |
I am seeing the same as @rasenplanscher . Using Angular 1.5.8 and UI-Select 0.19.6 EDIT: I also use jQuery, however, I completely removed it and the same thing is happening with jQLite. Somehow the monkey-patching of angular.element isn't working here:
|
As it turns out, this issue was actually webpack related. I needed to provide the select.js file the angular module that I was using. I added this loader:
|
I also had this problem when i use ui-select.js 0.11.2 ,and i upgrade the latest version(0.19.5), it's solved |
@abobwhite when I added what you said, I got this:
Any idea why? |
@refaelos You probably need the webpack @vermouth1994 That's probably because ui-select didn't have module support until something like 0.14.x....so it definitely wouldn't have worked before that. |
@abobwhite perfect. Thanks! |
I have this message error: "Error: [ui.select:transcluded] Expected 1 .ui-select-match but got '0'" with angular 1.5. |
@rasenplanscher |
Still happening with SELECTIVE theme and angular > 1.5 |
ui-select v0.19.5 has issues with ngAnimate angular-ui/ui-select#224 Here is workaround https://github.com/angular-ui/ui-select/ issues/1325#issuecomment-160922087 to run current ui-select with new angular version. Add class to ui-select-match and ui-select-choices with the same name. Change-Id: Ifd6103afcfa6704daaa8335cce6d52ab4bcd3208 Reviewed-on: http://review.couchbase.org/77239 Tested-by: Pavel Blagodov <[email protected]> Reviewed-by: Michael Wiederhold <[email protected]>
Still getting this with selectize theme FYI: Using bootstrap theme works |
ui-select-match and ui-select-choices add class tag is ok |
This issue manifests if a multi-select ui-select element is created after the first one is loaded. See http://plnkr.co/edit/S5umhcrVW71T2LAYcCv8?p=preview Clicking the add button creates new ui-select elements via ng-repeat directives in the parent elements. For single-select, there is no problem, but the error message appears every time the Add button is clicked for the multi-select. Adding ui-select-match and ui-select-choices classes in the respective elements did not appear to make any difference - this is included in the plunker. |
Can confirm this is happening to us. We're developing a custom directive which wraps a ui-select and passes user-defined attributes to the Using Angular 1.4.14 and angular-ui-select 0.19.8. |
@tvStatic did you ever find a solution? I'm having the same problem in the same scenario. |
I have used the following snippet to create the dropdown
ui-select ng-model="option.name" theme="select2" ng-disabled="disabled" style="width: 100%">
ui-select-match placeholder="Select">{{$select.selected.name || $select.selected}}
/ui-select-match>
ui-select-choices repeat="option in options.options | filter: $select.search">
div ng-bind-html="options.name | highlight: $select.search">
/ui-select-choices>
/ui-select>
But I am facing the error
Error: [ui.select:transcluded] Expected 1 .ui-select-match but got '0'.
Referenced the plunker http://plnkr.co/edit/1D614lgGZmRkff9jG2GR?p=preview to develop.
Help me out -
-Dinesh
The text was updated successfully, but these errors were encountered: