This repository was archived by the owner on Apr 12, 2024. It is now read-only.
fix(ngOptions): iterate over the options collection in the same way as `... #11771
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
...ngRepeat`
In
ngRepeat
if the object to be iterated over is "array-like" then it only iteratesover the numerical indexes rather than every key on the object. This prevents "helper"
methods from being included in the rendered collection.
This commit changes
ngOptions
to iterate in the same way.BREAKING CHANGE:
Although it is unlikely that anyone is using it in this way, this change does change the
behaviour of
ngOptions
in the following case:ngOptions
syntax(
item.label for item in items
) and that object contains non-numeric property keys.In this case these properties with non-numeric keys will be ignored.
** Here array-like is defined by the result of a call to this internal function:
https://github.com/angular/angular.js/blob/v1.4.0-rc.1/src/Angular.js#L198-L211 **
To get the desired behaviour you need to iterate using the object form of the
ngOptions
syntax(
value.label
for (key, value) in items)`).Closes #11733