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

ng-repeat behavior inconsistency with js objects #1430

Closed
SteveShaffer opened this issue Oct 1, 2012 · 4 comments
Closed

ng-repeat behavior inconsistency with js objects #1430

SteveShaffer opened this issue Oct 1, 2012 · 4 comments

Comments

@SteveShaffer
Copy link
Contributor

There seems to be very different behavior between the two forms of ng-repeat, the "thing in things" and "(key, value) in things".

Please see this jsfiddle: http://jsfiddle.net/ktDUW/3/

In each case, the behavior is different, and none of those cases work for me for direct editing of javascript object properties (like a dictionary/hash).

I could be missing something, but if I'm not, I think there should be a note in the documentation about the different behaviors and possibly the best options for certain use cases.

@gleber
Copy link

gleber commented Oct 2, 2012

I am hitting this particular problem myself. The way to avoid it is to use complex objects as values in the object. But this is hacky. I would love to see this fixed.

@petebacondarwin
Copy link
Contributor

The problems in case 2 & 3 are to do with JavaScript. Primitive types are passed by value and so the inner scope has no way of knowing that it should update the value on the outer scope.
The last case is fixed in this PR: #1661. You should probably track that to see if it gets into master at some point!

@SteveShaffer
Copy link
Contributor Author

Cool. Thanks Pete.

@darkyen
Copy link

darkyen commented Jul 28, 2014

This saved me half a day of work :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants