Skip to content

Regression in MatButtonToggleGroup: Value not applied on buttons model update #10690

@dobrevad

Description

@dobrevad

Bug, feature request, or proposal:

Regression bug

What is the expected behavior?

Updating the button toggles model and the group value results in the button toggle with this value being checked.

What is the current behavior?

When the buttons model and the group value are dynamically updated, no button toggle is selected.

What are the steps to reproduce?

Not reproducible in @angular/[email protected].
See the working example in https://stackblitz.com/edit/angular-bmrtvf-qubr3j?file=app%2Fbutton-toggle-exclusive-example.html.

Click "Switch Model". See that there is a selection with the new model.

Reproducible in @angular/[email protected]
See repro in https://angular-material2-issue-xzuj4n.stackblitz.io.

To reproduce click "Switch Model". Expect to see the first option selected but nothing is selected.

The culprit is: a403bac#diff-0ab4e17fb83eadabf9c87d06e36e93d3

What changed:
When setting the group value it is not applied unless the current list of button toggles contains the input value.
Before:
The group value was always set. Then when button toggles were created, if their value matched the group value the button will be checked.

What is the use-case or motivation for changing an existing behavior?

n/a

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

Material: 6.0.0

Is there anything else we should know?

Metadata

Metadata

Assignees

Labels

GThis is is related to a Google internal issueregressionThis issue is related to a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions