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

track by $index broken with angular 1.5 #1522

Closed
gorghoa opened this issue Mar 25, 2016 · 3 comments
Closed

track by $index broken with angular 1.5 #1522

gorghoa opened this issue Mar 25, 2016 · 3 comments

Comments

@gorghoa
Copy link

gorghoa commented Mar 25, 2016

Bug description:

When using track by $index for the repeat attribute, with angular < 1.5, ui-select used to generate an id of the form

<div id="ui-select-choices-row-0-2" …>

Now, with angular 1.5(.2) we get :

<div id="ui-select-choices-row-0-" …>

The last digit is missing. It should be replace by the value of $index, but $index is undefined.

I’ve written a test for the issue :

gorghoa/ui-select@d627eef45755d7ac0e4c81a231989f576d0512c8

The test is ok with angular 1.4.10, broken with 1.5

Version of Angular, UI-Select, and Bootstrap/Select2/Selectize CSS

Angular: 1.5.2

Let me know if I can do more.
thanks!

@wesleycho
Copy link
Contributor

Cross-linking #1525 - they are identical, although I add a Plunker reproduction. I noticed this in my work app, and it caused some QA automation to fail.

@user378230
Copy link
Contributor

From #1525

Bug description:

When using the regular repeat attribute in ui-select-choices with ng-repeat syntax, the id attribute repeats ui-select-choices-row-0-, leading to selector issues. Note that this does not occur when the optgroup feature is used.

Link to minimally-working plunker that reproduces the issue:

Type New York into the input and inspect the id attributes of the repeated elements at any point where there are 2+ results in the dropdown.

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

Version of Angular, UI-Select, and Bootstrap/Select2/Selectize CSS

Angular: 1.5.2

UI-Select: 0.16.0

Bootstrap/Select2/Selectize CSS (if applicable): N/A


From editing the plunkr it looks like using ng-attr-id would fix it, don't know if that would break anything else, though I doubt it would.

If someone beats me to it with a working PR (incl. provided test) I'll be happy to merge

@user378230
Copy link
Contributor

So the change works but annoyingly the test only works in isolation (iit(...)) and not when run as part of the entire suite. 😠

user378230 pushed a commit to user378230/ui-select that referenced this issue Mar 28, 2016
The id attribute on ui-select-choices-row is no longer interpolated
correctly when using ui select with angular v1.5+.

This change switches to using ng-attr-id to ensure the id value is
correctly interpolated before being assigned to the element.

Fixes angular-ui#1522
user378230 pushed a commit to user378230/ui-select that referenced this issue Mar 28, 2016
The id attribute on ui-select-choices-row is no longer interpolated
correctly when using ui select with angular v1.5+.

This change switches to using ng-attr-id to ensure the id value is
correctly interpolated before being assigned to the element.

Fixes angular-ui#1522
user378230 pushed a commit to user378230/ui-select that referenced this issue Mar 29, 2016
The id attribute on ui-select-choices-row is no longer interpolated
correctly when using ui select with angular v1.5+.

This change switches to using ng-attr-id to ensure the id value is
correctly interpolated before being assigned to the element.

Fixes angular-ui#1522
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants