You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As with mat-select, setting the selected-attribute on a mat-list-option should not trigger the selectionChange event, as this in many cases causes unintentional behavior (e.g. when setting initial state on component initialization).
What is the current behavior?
Setting the selected-attribute on a mat-list-option triggers the selectionChange event, as if the element was selected by the user.
What are the steps to reproduce?
http://plnkr.co/edit/SBTQUM2Pl2TcNhSQaDW0?p=preview
In the plunkr above, each selectionChange event from the element in the selection list pushes a new element to the log array. The button that programatically sets the selected state should not trigger a selectionChange.
What is the use-case or motivation for changing an existing behavior?
I wish to set the intitial state of my selection-list based on a query parameter in the url. This causes unintentional behavior, since setting the selected-attribute triggers a selectionChange event, which in my case triggers a HTTP-request. My current workaround is using a mat-select, which does not trigger a change-event upon setting the checked-attribute programatically.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Activity
devversion commentedon Nov 20, 2017
Should be revisited after #7456
devversion commentedon Dec 6, 2017
Fixed with #7456
angular-automatic-lock-bot commentedon Sep 7, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.