Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

ng-repeat $middle and $last incorrect when object contains $$hashKey #1789

Closed
jussik opened this issue Jan 11, 2013 · 1 comment
Closed

ng-repeat $middle and $last incorrect when object contains $$hashKey #1789

jussik opened this issue Jan 11, 2013 · 1 comment

Comments

@jussik
Copy link
Contributor

jussik commented Jan 11, 2013

If you use ng-repeat on an object with a $$hashKey, like inside another ng-repeat, the $$hashKey is included in the object size even though it's not displayed in the DOM. This causes $middle and $last to be calculated like there is one more repetition, so the last element is still $middle and $last is never true.

jsFiddle: http://jsfiddle.net/PhkNK/
Plunker: http://plnkr.co/edit/eaFPleVozysvskk1QlhT

Should be (first, middle, last) like in the first block, not (first, middle, middle) like the last two.

@petebacondarwin
Copy link
Contributor

Confirmed that this also fails on current unstable: v1.1.1.
http://plnkr.co/edit/rUR5uC52iJ7zS3P8AwOQ?p=preview

petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jan 11, 2013
…tered out

If the $last property is calculated from the original collectionLength on an object and properties starting with $ were filtered out, then $last is never applied and $middle is applied erroniously.
This fix uses the length of the filtered array instead.

Fixes angular#1789
IgorMinar pushed a commit to IgorMinar/angular.js that referenced this issue Jan 17, 2013
If the $last property is calculated from the original collectionLength
on an object and properties starting with $ were filtered out, then $last
is never applied and $middle is applied erroniously.

Fixes angular#1789
IgorMinar pushed a commit to IgorMinar/angular.js that referenced this issue Jan 17, 2013
If the $last property is calculated from the original collectionLength
on an object and properties starting with $ were filtered out, then $last
is never applied and $middle is applied erroniously.

Closes angular#1789
IgorMinar pushed a commit to IgorMinar/angular.js that referenced this issue Jan 17, 2013
If the $last property is calculated from the original collectionLength
on an object and properties starting with $ were filtered out, then $last
is never applied and $middle is applied erroniously.

Closes angular#1789
jamessharp pushed a commit to jamessharp/angular.js that referenced this issue Jan 18, 2013
If the $last property is calculated from the original collectionLength
on an object and properties starting with $ were filtered out, then $last
is never applied and $middle is applied erroniously.

Closes angular#1789
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants