-
Notifications
You must be signed in to change notification settings - Fork 27.4k
track By no longer working #9592
Comments
Hi @weisk are you referring to the fact that the |
But the behavior I mentioned is also present in rc.4, so you must be referring to something else. |
See updated plunk: http://plnkr.co/edit/sScmKu?p=preview I would expect that If you change the angular version to rc4 you will see that it works fine.. |
Ahh, I see. This was undocumented and untested behavior that was refactored out as we fixed other issues. In your case, since you're not using a |
There's also been some discussion of making <select ng-model="myModel">
<option ng-value="item as item.id" ng-repeat="item in items">{{item.name}}</option>
</select> Where |
I think we should fix this! |
+1 I relied on the For example option values in code like this |
@tbosch, I love your enthusiasm :). Since we've discussed this in person in some length, would you mind commenting with how you arrived at this conclusion? I want this feature to be supported, but to change the behavior in place would actually be a breaking change now, since we've documented how values are assigned with ng-options: https://docs.angularjs.org/api/ng/directive/select
Some options:
What are your thoughts, @tbosch? cc: @IgorMinar |
Talked with @IgorMinar and @jeffbcross again about this and came to the conclusion that we should revert this to the previous behavior, i.e. that when a |
So glad to hear !!! Thanks guys |
Great to hear it will be reverted 👍 |
Will we ever sit down and re-implement (I know I won't like the answer, but I have to ask anyway 😛) |
@gkalpak in rc.5 @tbosch and I added more tests and refactored/simplified it some more, so it's much better than it used to be. This feature was just something undocumented and not explicitly tested, so we missed it. I think there's still more that could be done to improve it, and if you want to submit a PR, @tbosch and I would be happy to review it :) |
@jeffbcross : I didn't see that coming :P I know what you did (and it was very nice indeed). I am talking more about re-designing it from scratch (because if I am not mistaken, it was initially implemented when things looked a lot different than (reagarding Obviously, re-designing this, is not a primary focus right now (and for good reason), but if you have anything specific in mind that could be improved, I would be glad to giveit a shot :) |
@gkalpak I hope I didn't come across as snarky! I'm really appreciative of all your help with this and other issues. I don't disagree that select/ngOptions is pretty rough. We're going to focus more on getting it right for 2.0 than on re-designing it in 1.x though. |
@jeffbcross: No, you didn't. (Did I sound like you did ? 😃) It is understandable that v2.x is the main focus right now. I wonder if there is a way for someone to get more involved into 2.x stuff yet. |
Fixes a regression where the option/select values would always be set to the key or index of a value within the corresponding collection. Prior to some 1.3.0 refactoring, the result of the track expression would be bound to the value, but this behavior was not documented or explicitly tested. This commit adds one explicit test for this behavior, and changes several other trackBy tests to reflect the desired behavior as well. Fixes angular#9592
+1! 👍 |
Fixes a regression where the option/select values would always be set to the key or index of a value within the corresponding collection. Prior to some 1.3.0 refactoring, the result of the track expression would be bound to the value, but this behavior was not documented or explicitly tested. A cache was added in order to improve performance getting the associated value for a given track expression. This commit adds one explicit test for this behavior, and changes several other trackBy tests to reflect the desired behavior as well. Closes angular#9718 Fixes angular#9592
Hi guys,
On v1.3.0-rc.5,
track by
won't set the inner value on<options>
with the desired property. Didn't happen on rc.4.See plnkr:
http://plnkr.co/edit/sScmKu?p=preview
Reproducable: always
Browsers: independent
Operating system: independent
The text was updated successfully, but these errors were encountered: