- Notifications
You must be signed in to change notification settings - Fork27.4k
feat(ngOptions): add $value variable for easier use of trackBy+selectAs#15584
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
52cde6c
to4962888
CompareNarretz commentedJan 7, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
So this is basically a shortcut for |
icholy commentedJan 7, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
In the simple case, yes.
Here's a contrived example (note the id's don't match up). $scope.items=[{id:0,label:'aLabel',subItem:{name:'aSubItem',id:1}},{id:1,label:'bLabel',subItem:{name:'bSubItem',id:0}}];$scope.selected=$scope.items[0].subItem; If you use demo:https://plnkr.co/edit/8MQXJpRqEdtwF1hcCM3w?p=preview edit: In my actual use case the |
@Narretz I noticed you put this in the Ice Box milestone and I don't want to invest more time into this if it's not going anywhere. I think that I presented a valid use case in my last comment, but if that's not the case, let me know so I don't waste my time. |
icholy commentedJan 26, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@Narretz I've add a bit more to the documentation, but I'm not sure about the tests. Here's what it says above the tests I changed.
This is what the |
Uh oh!
There was an error while loading.Please reload this page.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature.
What is the current behavior? (You can also link to an open issue here)
Currently it's a pain to use
trackBy
andselectAs
together.What is the new behavior (if this is a feature change)?
It introduces a
$value
variable which simplifies how thetrackBy
expression can be written.Does this PR introduce a breaking change?
No.
Please check if the PR fulfills these requirements