Skip to content

bug(radio): radio group selected not set in Ivy on initialization #21148

@kyubisation

Description

@kyubisation

We noticed that for the mat-radio-group in Ivy, the writeValue is called after the nested mat-radio's have been initialized, but before the @ContentChildren are resolved. This means the selected property of the mat-radio-group will not be set.

This works in ViewEngine, as the writeValue is called before the ngOnInit of the mat-radio's are called (which in turn assigns checked, which in turn assigns selected on the group).

Reproduction

Use StackBlitz to reproduce your issue:
https://stackblitz.com/edit/angular-ukua2k?file=src%2Fapp%2Fradio-overview-example.html

Steps to reproduce:

  1. Open StackBlitz example
  2. Ensure Ivy is enabled
  3. See Selected Value: being null

Expected Behavior

Selected Value: "2"

Actual Behavior

Selected Value: null

Environment

  • Angular: 11.0.2
  • CDK/Material: 11.0.1
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions