-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Work-around for major 1.3x ng-options issue? #11835
Comments
When I added track by option.id to the end of the ng-options, it was selecting the option. I forked and updated the plunker here: http://plnkr.co/edit/EGEL1yRIRDauKEOZAzdK?p=preview. Hopefully this helps resolve your issue. |
Thanks for trying. I just tested your plnkr.co. It doesn't work for other IDs such as https://docs.angularjs.org/api/ng/directive/ngOptions (although based on version 1.4)
|
@petebacondarwin any thoughts on a work-around, since you're perhaps closest to ng-options, having reworked it in 1.4? |
I believe the main problem here is that the select control does not realise that the options have changed. |
Thanks Pete! The plnkr works as expected. I appreciate your prompt On Fri, May 8, 2015 at 7:56 AM, Pete Bacon Darwin [email protected]
|
I'll go out on a limb and say there'll be likely no patch for this. It's simply not worht the effort from my perspective. If someone can provide a patch, I'll be happy to merge it. But that's just my opinion. |
I guess strictly speaking we already have a patch (7fda214). It's part of the 1.4 release, which hopefully should be released soon (wink wink). So, the key question is can we backport the patch into a 1.3.x patch release? Excluding time and effort, for me I think it comes down to whether the the bigger "risk" is leaving 1.3x ng-options in a faulty state, where apps could show invalid data, or add a patch version with a breaking feature (where the select's "option value" is no longer sequential integers). I say the former outweighs the latter. In addition, 1.4 has many major changes, so it wont be a one and done deal for projects moving to 1.4 solely to address the ng-options issues without encountering unrelated regression issues. Perhaps we can use 7fda214 as a starting point for 1.3.x patch? |
@pisaacs would you like to offer a pull request against 1.3? We are working full steam ahead to get 1.4.0 out the door very soon. |
@petebacondarwin - would love to give it a shot, but I'm running into issues with environmental dependencies. I just posted a $30 bounty on Bountysource: https://www.bountysource.com/issues/13596035-work-around-for-major-1-3x-ng-options-issue The bounty will go to the person whose pull request is a backport of ng-options from 1.4.0-rc.2+ and merged with 1.3. |
The selectCtrl ```addOption``` compares the label value with the ngModel value when determining when to set the value of the select element. This causes a problem if the label matches model value but not the selectAs value of the option. fixes angular#11835
The selectCtrl ```addOption``` compares the label value with the ngModel value when determining when to set the value of the select element. This causes a problem if the label matches model value but not the selectAs value of the option. fixes angular#11835
Since this is fixed in 1.4, we've decided to not fix this in 1.3, as it would require a huge effort / possibly a breaking change (see e.g. #11171 (comment)), and we think that we will help developers more by improving other areas of angular instead. That said, there are two possible workarounds for this issue:
|
ng-options
has major issues in the 1.3x branch (see #9714 and Breaking Changes under '1.4.0-beta.0' in the CHANGELOG: https://github.com/angular/angular.js/blob/master/CHANGELOG.md ).My Angular 1.3.3 production app just hit a wall with this issue: http://plnkr.co/edit/JCM2NOxxO4OFoWybmQhp?p=preview
This issue is addressed in 1.4.0-rc.0+. However, while 1.4 continues to bake (and hopefully comes out soon), what would be a possible work around?
The text was updated successfully, but these errors were encountered: