components icon indicating copy to clipboard operation
components copied to clipboard

radio does not respect [ngModelGroup]

Open sky-coding opened this issue 10 years ago • 2 comments

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When duplicate name attributes are placed on text input elements within the same page, they do not interfere with each other as long as they are under independent [ngModelGroup]s. I would expect the same behavior from <md-radio-group>

What is the current behavior?

<md-radio-group> needs a completely unique name attribute or it interferes with duplicately named <md-radio-group>s.

What are the steps to reproduce?

See Plunker for demo: http://plnkr.co/edit/kyK75O?p=preview

You can see that the "Material Radios" rows do not behave properly but the "Material Radios w/ index" rows do.

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

We are appending indices to the name attribute everywhere which is not elegant, and is difficult to target during automation.

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

Latest (angular 2.1.2 w/ angular-material 2.0.0-alpha.8-2)

Is there anything else we should know?

As shown in the Plunker, native radio buttons also require a unique name. Native text inputs, however, respect the [ngModelGroup] on line 11, and do not conflict. I am using native radios as suggested here: https://github.com/angular/angular/pull/9228

Looking for discussion to see if this radio button behavior is expected or has a workaround for non-uniquely name'd elements.

sky-coding avatar Nov 07 '16 23:11 sky-coding

This is working as intended. Radio button unique selection is based off the the name property, and this carries over to their parent radio groups.

jelbourn avatar Nov 09 '16 04:11 jelbourn

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.