Angular2 - RadioButtonState 没有按预期工作

Angular2 - RadioButtonState not working as expected

我在尝试使 RadioButtonState 按预期工作时遇到了一些麻烦。我尝试通过以下方式使用 RadioButtonState:

import {Component} from '@angular/core';
import {RadioButtonState} from '@angular/common';
import {bootstrap} from '@angular/platform-browser-dynamic';

@Component({
    selector: 'my-app',
    template:`
    Select Gender:
    <span *ngFor="let gender of inputs; let i=index" >
        <input type="radio" name="gender" [(ngModel)]="inputs[i]" /> {{gender.value}}
    </span>

    <br>
    {{inputs | json}}
    `
})
export class AppCmp{
    public inputs = [
        new RadioButtonState(false,"Male"),
        new RadioButtonState(false,"Female")
    ]
}

bootstrap(AppCmp);

当我单击任何单选按钮时,它会使值变为真,但在单选按钮之间切换不会使它们再次变为假。我重现了问题here on plunker.

这是一个已知问题https://github.com/angular/angular/issues/7374

解决此问题之前提到的解决方法:

<label class="radio-inline">
  <input type="radio"
      value="male" 
      #male
      [checked]="child.gender === 'male'"
      (click)="child.gender = male.value"
      name="gender">Male</label>                   

<label class="radio-inline">
  <input type="radio"
      #female
      value="female"
      [checked]="child.gender === 'female'" 
      (click)="child.gender = female.value" 
      name="gender">Female</label>