Open aronmgv opened 8 years ago
Can you provide a reproduction plunkr with the latest version of ui-select?
@MacGyver27 Do you have ngAnimate in your project? I had a similar error when ngAnimate is present, removing the module or deactivating it for the select item should fix the error.
@SamuelPadou That was it! ngAnimate is causing this problem with latest ui-select. Thank you for this input. Either not including ngAnimate to your project or disabling it in your controller works for now..
Plunkr: https://plnkr.co/edit/ITCtDdiC5U4H7WAFm2Dz?p=preview
got exact same error, ngAnimate is not even installed
The issue occurs when I'm not giving the ui-select-choices directive a class of "ui-select-choices" and the ui-select-match directive a class of "ui-select-match". Adding those classes fixes the issue.
Any other workaround though?
But... what if i'm using ng-animate?
I think the code in "ctrl.activate" function, which checks if animation finished, should also check that the drop-down is opened; this error is obtained as the '.ui-select-choices-row' controls are not found (as the drop-down is already closed).
Below is the modified code (in uiSelectController.js -> ctrl.activate function; added the && ctrl.open part in if statement) which works for me (i.e. I am no longer seeing the error message "Expected multiple .ui-select-choices-row but got '{0}'.")
// check that drop-down is opened before calling focus function
if (phase === 'close' && ctrl.open) {
// Only focus input after the animation has finished
$timeout(function () {
ctrl.focusSearchInput(initSearchValue);
});
}
+1. Also having this issue when calling toggle() on the ui-select. Edit: Also calling activate() may have the same issue as activate() will be invoked on condition in toggle().
Versions: Angular-ui-select: v0.15.0 Angular: v1.3.15
It appears that calling toggle() is causing the following to happen:
This leads to choices < 1 so it throws an error.
Edit: I've deduced that this is a race case happening with list items being loaded when a modal is shown. I've fixed this by waiting till the end of the execution cycle to invoke toggle() (or activate()) on the ui-select element. This solved the issue.
AbdallaMohamed : Thanks that workaround worked for me!!!
.ui-select-toggle > .caret { pointer-events: none } fixes the problem for me
@nikulinsanya Solutions works for me. Note, This issue is related to using the Bootstrap Theme. It works fine under the 'selectize' theme
@nikulinsanya Thank you so much . It works for me too . great job.
This worked for me too, lucky i wasn't using ng-animate i guess.
Hey,
I am getting this error message
Error: [ui.select:choices] Expected multiple .ui-select-choices-row but got '0'.
when I select item from drop down list. (ui-select 0.14.9 (even 0.14.0), angular 1.5.0 or angular 1.4.9). Basically since 0.14.0 with both angular 1.4.x or 1.5.0.It gets generated instant many times after I select..
Also other effect is that I cannot scroll immediately.. It gets stuck for about 2s (200 items) and then it allows me to scroll/select and is smooth again.
My setup (does the same without classes):
So far working configuration for me was only ui-select 0.13.2 and Angular 1.4.9 without classes specified:
No issues with scrolling and (list load) lag either. Smooth right after the page refresh.
Any inputs will help me. Thanks, Michal