Skip to content

mat-button-toggle-group selected button deselects on data-binding change #15297

Closed
@e-thn

Description

@e-thn

What is the expected behavior?

The mat-button-toggle-group retains the currently selected button toggle when updating data-sources (an array of objects with a string property).

What is the current behavior?

When using a mat-button-toggle-group with an ngFor, if the array of items being iterated over is changed to a different list of items, then the 'should be selected' button toggle becomes deselected.

What are the steps to reproduce?

ver. 7.3.1
https://stackblitz.com/edit/mat-button-toggle-issue
ver. 7.2.0
https://stackblitz.com/edit/mat-button-toggle-issue-working

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

My current version of angular material is 7.3.3, the last version I can find that the issue is not present is version 7.2.0.

Other Info

My guess is this issue is related to this commit.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions