components icon indicating copy to clipboard operation
components copied to clipboard

mat-radio-group data binding requires unique name

Open kwall2004 opened this issue 8 years ago • 3 comments

Bug, feature request, or proposal:

If a component contains mat-radio-group, and you create multiple instances of that component, the mat-radio-group names appear to collide.

What is the current behavior?

I have to ensure unique mat-radio-group names in order for data binding to work properly.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-ujce61?file=app%2Ftest%2Ftest.component.html

kwall2004 avatar Feb 19 '18 22:02 kwall2004

Closing as this is working as intended. Within forms the name for a value control must be unique to prevent this collision.

josephperrott avatar Feb 20 '18 21:02 josephperrott

@josephperrott, within a form, of course names must be unique, but in this example I have separate forms, one in each instance of the component.

I've simplified the code somewhat here: https://stackblitz.com/edit/angular-gt2qqc

See that both the material radio group and the standard html radio inputs are bound to the same property, yet the material radio group binding only works in the 3rd instance.

kwall2004 avatar Feb 20 '18 22:02 kwall2004

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.