8000 bug(mat-selection-list): Model change fired twice for the selection list with [multiple]="false" · Issue #22276 · angular/components · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
bug(mat-selection-list): Model change fired twice for the selection list with [multiple]="false" #22276
Closed
@Vitaljok

Description

@Vitaljok

For the mat-selection-list with multiple selections disabled the model change event is fired twice.

StackBlitz to reproduce:

Steps to reproduce:

  1. Change the selection
  2. 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.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/list

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0