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

fix(ngRepeat): should correctly track elements even when the collection is initially undefined #4145

Closed
wants to merge 1 commit into from

Conversation

jankuca
Copy link
Contributor

@jankuca jankuca commented Sep 24, 2013

Closes #3964

@mary-poppins
Copy link

Thanks for the PR!

  • Contributor signed CLA now or in the past
    • If you just signed, leave a comment here with your real name
  • PR's commit messages follow the commit message format

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@@ -282,9 +282,9 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {

if (isArrayLike(collection)) {
collectionKeys = collection;
trackByIdFn = trackByIdFn || trackByIdArrayFn;
trackByIdFn = trackByIdArrayFn || trackByIdFn;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to make the code more readable, could we rename the trackByIdFn in the outer scope to trackByIdExpFn and introduce a new variable called trackByIdFn in this ($watchCollection callback) scope. With that change the code is easier to understand and the bug will be fixed no matter what's the order of operands in this expression.

@IgorMinar
Copy link
Contributor

otherwise this looks great. thanks

@ghost ghost assigned IgorMinar Sep 25, 2013
@IgorMinar
Copy link
Contributor

please add Closes #4145 on a new line in the commit message.

@jankuca jankuca closed this in 31c56f5 Sep 25, 2013
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
…nitially undefined

Previously if the collection model was set to undefined on the first digest,
the repeater would get confused and not use the correct tracking function
for associating model with dom elements in the repeater.

Closes angular#4145
Closes angular#3964
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
…nitially undefined

Previously if the collection model was set to undefined on the first digest,
the repeater would get confused and not use the correct tracking function
for associating model with dom elements in the repeater.

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

Successfully merging this pull request may close these issues.

Directive scope "sticking" within ngRepeat (1.2.0+)
4 participants