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

fix(select): keep ngModel when selected option is recreated with ngRe… #15632

Merged
merged 4 commits into from Jan 26, 2017

Conversation

Narretz
Copy link
Contributor

@Narretz Narretz commented Jan 20, 2017

…peat

Fixes #15630

@Narretz
Copy link
Contributor Author

Narretz commented Jan 20, 2017

Looks like my test passes without the patch 😨 Let's see

@Narretz
Copy link
Contributor Author

Narretz commented Jan 20, 2017

Test has been fixed

Copy link
Member

@gkalpak gkalpak left a comment

Choose a reason for hiding this comment

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

LGTM (with one optional suggestion).

expect(scope.obj.value).toBe('B');

scope.$apply(function() {
// Only when new objects are used, ngRepeat re-creates the element from scratch
Copy link
Member

Choose a reason for hiding this comment

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

Just to make it more explicit, I would add an expactation that optionElements[1] (before) !== optionElements[0] (after).

@Narretz
Copy link
Contributor Author

Narretz commented Jan 25, 2017

Updated, PTAL

var previouslySelectedOptionElement = optionElements[1];
optionElements = element.find('option');
expect(optionElements.length).toEqual(3);

Copy link
Member

Choose a reason for hiding this comment

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

Misplaced newline?

@Narretz Narretz force-pushed the fix-select-ngrepeat-unselect branch from f1866fe to 4e0501b Compare January 26, 2017 11:28
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

1 similar comment
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@Narretz Narretz force-pushed the fix-select-ngrepeat-unselect branch from 4e0501b to cba1178 Compare January 26, 2017 11:31
@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

@Narretz Narretz merged commit 89f3e3b into angular:master Jan 26, 2017
ellimist pushed a commit to ellimist/angular.js that referenced this pull request Mar 15, 2017
odedniv pushed a commit to odedniv/angular.js that referenced this pull request Apr 14, 2017
@odedniv
Copy link

odedniv commented Apr 15, 2017

This is a really bad breakage, why isn't this in 1.6 already? Is it waiting for something I can help with?

@Narretz
Copy link
Contributor Author

Narretz commented Apr 15, 2017

Hi @odedniv this is in 1.6 as 131af82, released with 1.6.2
Not sure why you think it's not in 1.6 yet

@odedniv
Copy link

odedniv commented Apr 15, 2017

@Narretz right, wasn't looking properly, but I'm still having issues with <select ng-model> resetting value that I don't have in 1.5. Any ideas?

@Narretz
Copy link
Contributor Author

Narretz commented Apr 15, 2017

@odedniv I don't know of any other issues and since my crystal ball is still in repair, I can't say what might be going on with your selects. Please open a new issue with a minimal reproduction of the problem. Thanks!

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

Successfully merging this pull request may close these issues.

None yet

4 participants