Skip to content

Changing options of MatButtonToggleGroup causes it to lose its currently displayed value #16423

Closed
@biltongza

Description

@biltongza

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/edit/angular-7-mat-button-toggle-loses-displayed-value

Steps to reproduce:

  1. Create a MatButtonToggleGroup with some options
  2. Select a value, observe that it sets its value correctly
  3. Update the options of it, ensuring that the currently selected option is still in the options array
  4. Observe that the button toggle group no longer displays its selected value

Expected Behavior

What behavior were you expecting to see?
The currently selected value is still a valid option so it should still be displayed as the selected option.

Actual Behavior

What behavior did you actually see?
The currently selected value is not displayed as the selected option, and the button group appears as if it has been reset.

Environment

  • Angular: 7.2.15
  • CDK/Material: 7.3.7
  • Browser(s): Google Chrome 75.0.3770.100 (Official Build) (64-bit), Firefox 67.0.4 (64-bit)
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10 1903 64 bit (18362.207)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions