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

ng-repeat does not work with primitive types #933

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

ng-repeat does not work with primitive types #933

vojtajina opened this issue May 4, 2012 · 5 comments
Assignees
Milestone

Comments

@vojtajina
Copy link
Contributor

http://jsfiddle.net/alexpetrov/tRxzr/

@zhenbzha
Copy link
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 ...

@IgorMinar
Copy link
Contributor

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
@ghost ghost assigned IgorMinar Nov 20, 2012
IgorMinar added a commit to IgorMinar/angular.js that referenced this issue Nov 23, 2012
This commits adds test for angular#933 and simplifies the implementation of the fix

Closes angular#933
IgorMinar added a commit to IgorMinar/angular.js that referenced this issue Nov 23, 2012
In cases when we reuse elements in a repeater but associate
them with a new scope (see angular#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 angular#933
IgorMinar added a commit to IgorMinar/angular.js that referenced this issue Nov 23, 2012
I'm reverting changes that were originally done to ngRepeat to fix angular#933,
because these are now not necessary after the previous changes to keep
ngModel always synced with the DOM.
IgorMinar added a commit that referenced this issue Nov 26, 2012
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.
IgorMinar added a commit that referenced this issue Nov 26, 2012
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.
IgorMinar added a commit that referenced this issue Nov 26, 2012
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.
IgorMinar added a commit that referenced this issue Nov 26, 2012
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
IgorMinar added a commit that referenced this issue Nov 26, 2012
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.
@IgorMinar
Copy link
Contributor

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)

@Nek-
Copy link

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

@petebacondarwin
Copy link
Contributor

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants