Closed
Description
For the mat-selection-list
with multiple selections disabled the model change event is fired twice.
StackBlitz to reproduce:
Steps to reproduce:
- Change the selection
- View result in the console:
onChange
is called twice.
Essential part of code:
<mat-selection-list [multiple]="false" [(ngModel)]="myValue" (ngModelChange)="onChange($event)">
...
</mat-selection-list>
An example is showing binding via [(ngModel)]
, but the same behavior is observed with reactive forms when valueChanges
are fired twice.
Expected Behavior
Model change should be fired once similar as it works for lists with multiple selections allowed.
Actual Behavior
Model change is fired twice.
Environment
- Angular: 11.2.5
- CDK/Material: 11.2.4
- Browser(s): Chrome 88.0.4324.150
- Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu
Edit: added essential part of code to the issue itself.