Skip to content

bug: group nested radios not working #205

@paullryan

Description

@paullryan

If you next radios inside different groups with different parents given that angular2-mdl is using checkboxes all groups sub radios are linked. This can cause odd and unintended side-effects with models that rely on nesting such as arrays of objects.

Steps to reproduce

  1. Create a form with with two formgroups like
<form [formGroup]="form">
  <div formGroupName="group1">
    <mdl-radio formControlName="type" value="type1">
    <mdl-radio formControlName="type" value="type2">
  </div>
  <div formGroupName="group2">
    <mdl-radio formControlName="type" value="type1">
    <mdl-radio formControlName="type" value="type2">
  </div>
</form>
  1. Create the corresponding form model
...
new FormGroup({
  group1: new FormGroup({
    type: new FormControl('')
  }),
  group2: new FormGroup({
    type: new FormControl('')
  })
});
...

This should result in a model of

{
  group1: {type: 'type1'}
  group2: {type: 'type2'}
}

however the boxes are being tied to each other. Not sure how to fix this one yet, however I'll think on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions