Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upmat-selection-list selects all when async update value of [selected] #17839
Comments
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Nov 29, 2019
…value in some cases The way we keep track of the value of an entire selection list is by taking all of the `selected` options and putting their values in an array. When the set of options is swapped out we look through that array to determine whether an option should be preselected. This breaks down if an option doesn't have a value, because we end up with a value array looking like `[undefined]` which will cause the option to be preselected incorrectly. These changes work around the issue by not adding options without a value to the value array. Fixes angular#17839.
This comment has been minimized.
This comment has been minimized.
Hi @crisbeto Just saw your fix. As a workaround, I could add a "non used" [value] at each option.
It seems to work. What do you think? Thanks for the quick fix !! |
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Dec 2, 2019
…value in some cases The way we keep track of the value of an entire selection list is by taking all of the `selected` options and putting their values in an array. When the set of options is swapped out we look through that array to determine whether an option should be preselected. This breaks down if an option doesn't have a value, because we end up with a value array looking like `[undefined]` which will cause the option to be preselected incorrectly. These changes work around the issue by not adding options without a value to the value array. Fixes angular#17839.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reproduction
Use StackBlitz to reproduce your issue: https://stackblitz.com/fork/components-issue
StackBlitz here : https://stackblitz.com/edit/components-issue-oawmjy
Steps to reproduce:
Expected Behavior
What behavior were you expecting to see?
Only first row should be checked
Actual Behavior
What behavior did you actually see?
3. 2 rows are checked
Environment