feat(ngOptions): add $value variable for easier use of trackBy+selectAs#15584
feat(ngOptions): add $value variable for easier use of trackBy+selectAs#15584icholy wants to merge 2 commits intoangular:masterfrom
Conversation
52cde6c to
4962888
Compare
|
So this is basically a shortcut for |
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. |
|
@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 |
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
trackByandselectAstogether.What is the new behavior (if this is a feature change)?
It introduces a
$valuevariable which simplifies how thetrackByexpression can be written.Does this PR introduce a breaking change?
No.
Please check if the PR fulfills these requirements