ng-repeat does not work with primitive types #933

Closed
vojtajina opened this Issue May 4, 2012 · 5 comments

Projects

None yet

6 participants

Contributor
zhenbzha commented May 8, 2012

Have detected these errors related to this one:
http://jsfiddle.net/zhenbzha/UAFeA/7/
http://jsfiddle.net/zhenbzha/8Hdje/
http://jsfiddle.net/zhenbzha/AgRy5/2/

Will try to submit a fix soon ...

@mhevery mhevery closed this in 46a2a3b Sep 4, 2012
@mhevery mhevery added a commit to mhevery/angular.js that referenced this issue Sep 7, 2012
@zhenbzha @mhevery zhenbzha + mhevery fix(ngRepeat): now works with primitive types
closes #933
e738bdb
Owner

the committed tests succeed even without the src changes, so the tests don't test this particular issue. reopening.

@IgorMinar IgorMinar reopened this Nov 20, 2012
@IgorMinar IgorMinar was assigned Nov 20, 2012
@IgorMinar IgorMinar added a commit to IgorMinar/angular.js that referenced this issue Nov 23, 2012
@IgorMinar IgorMinar refactor(ngRepeat): add tests and simplify code
This commits adds test for #933 and simplifies the implementation of the fix

Closes #933
5e5c724
@IgorMinar IgorMinar added a commit to IgorMinar/angular.js that referenced this issue Nov 23, 2012
@IgorMinar IgorMinar fix(ngModel): sync ngModel state with scope state
In cases when we reuse elements in a repeater but associate
them with a new scope (see #933 - repeating over array of
primitives) it's possible for the internal ngModel state and
the scope state to get out of sync. This change ensure that
the two are always sync-ed up even in cases where we
reassociate an element with a different (but similar) scope.

In the case of repeating over array of primitives it's still
possible to run into issue if we iterate over primitives and
use form controls or similar widgets without ngModel - oh well,
we'd likely need a special repeater for primitives to deal
with this properly, even then there might be cornercases.

Closes #933
ab1f1c8
@IgorMinar IgorMinar added a commit to IgorMinar/angular.js that referenced this issue Nov 23, 2012
@IgorMinar IgorMinar fix(ngRepeat): support mostly-stable repeating for primitives
I'm reverting changes that were originally done to ngRepeat to fix #933,
because these are now not necessary after the previous changes to keep
ngModel always synced with the DOM.
2f34fe8
@IgorMinar IgorMinar added a commit that referenced this issue Nov 26, 2012
@IgorMinar IgorMinar fix(ngRepeat): attempt to simplify and improve existing fix for #933
I'm keeping this in for future reference. The issue with this solution
is that if we shift() the first item in the array, the whole repeater
DOM will be rebuilt from scratch, we need to do better than that.
d644dcf
@IgorMinar IgorMinar added a commit that referenced this issue Nov 26, 2012
@IgorMinar IgorMinar fix(ngModel): sync ngModel state with scope state
In cases when we reuse elements in a repeater but associate
them with a new scope (see #933 - repeating over array of
primitives) it's possible for the internal ngModel state and
the scope state to get out of sync. This change ensure that
the two are always sync-ed up even in cases where we
reassociate an element with a different (but similar) scope.

In the case of repeating over array of primitives it's still
possible to run into issue if we iterate over primitives and
use form controls or similar widgets without ngModel - oh well,
we'd likely need a special repeater for primitives to deal
with this properly, even then there might be cornercases.

Closes #933
e6d9bea
@IgorMinar IgorMinar added a commit that closed this issue Nov 26, 2012
@IgorMinar IgorMinar fix(ngModel): sync ngModel state with scope state
In cases when we reuse elements in a repeater but associate
them with a new scope (see #933 - repeating over array of
primitives) it's possible for the internal ngModel state and
the scope state to get out of sync. This change ensure that
the two are always sync-ed up even in cases where we
reassociate an element with a different (but similar) scope.

In the case of repeating over array of primitives it's still
possible to run into issue if we iterate over primitives and
use form controls or similar widgets without ngModel - oh well,
we'd likely need a special repeater for primitives to deal
with this properly, even then there might be cornercases.

Closes #933
e6d9bea
@IgorMinar IgorMinar closed this in e6d9bea Nov 26, 2012
@IgorMinar IgorMinar added a commit that referenced this issue Nov 26, 2012
@IgorMinar IgorMinar fix(ngRepeat): support mostly-stable repeating for primitives
I'm reverting changes that were originally done to ngRepeat to fix #933,
because these are now not necessary after the previous changes to keep
ngModel always synced with the DOM.
1b17dfa
@IgorMinar IgorMinar added a commit that referenced this issue Nov 26, 2012
@IgorMinar IgorMinar fix(ngRepeat): attempt to simplify and improve existing fix for #933
I'm keeping this in for future reference. The issue with this solution
is that if we shift() the first item in the array, the whole repeater
DOM will be rebuilt from scratch, we need to do better than that.
00e7e31
@IgorMinar IgorMinar added a commit that referenced this issue Nov 26, 2012
@IgorMinar IgorMinar fix(ngModel): sync ngModel state with scope state
In cases when we reuse elements in a repeater but associate
them with a new scope (see #933 - repeating over array of
primitives) it's possible for the internal ngModel state and
the scope state to get out of sync. This change ensure that
the two are always sync-ed up even in cases where we
reassociate an element with a different (but similar) scope.

In the case of repeating over array of primitives it's still
possible to run into issue if we iterate over primitives and
use form controls or similar widgets without ngModel - oh well,
we'd likely need a special repeater for primitives to deal
with this properly, even then there might be cornercases.

Closes #933
6a83149
@IgorMinar IgorMinar added a commit that referenced this issue Nov 26, 2012
@IgorMinar IgorMinar fix(ngRepeat): support mostly-stable repeating for primitives
I'm reverting changes that were originally done to ngRepeat to fix #933,
because these are now not necessary after the previous changes to keep
ngModel always synced with the DOM.
cde2f1a
Owner

I'm keeping this issue open because as @petebacondarwin noticed even the existing fixes result in loss of focus when primitive array elements are being edited in place: #1602 (comment)

@IgorMinar IgorMinar reopened this Nov 26, 2012
Nek- commented Aug 9, 2013

Hello i'm new with angular.

Is this bug in direct relation with this issue ? (the content is hidden, take a look to the class of the ngRepeat)

If not I should probably open a new issue.

http://plnkr.co/edit/Kg7tkpD4pKMz7eKTOIQS

Member

This issue is fixed in master: http://plnkr.co/edit/fikTevt0bGALj2aYFhj2?p=preview
@Nek - Can you open a new issue with your problem? It seems that ng-view and ng-repeat are sharing their animation classes...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment