我有3个单选按钮如下:
html的:
<input type="radio" name = "options" value="All" [checked]='selectedRadioButtonValue' (input)='selectedRadioButtonValue=$event.target.value' />
<span class="radioClass">{{"All("+all+")"}}</span>
<input type="radio" name = "options" value="Male" [checked]='selectedRadioButtonValue' (input)='selectedRadioButtonValue=$event.target.value' />
<span class="radioClass">{{"Male("+male+")"}}</span>
<input type="radio" name = "options" value="Female" [checked]='selectedRadioButtonValue' (input)='selectedRadioButtonValue=$event.target.value' />
<span class="radioClass">{{"Female("+female+")"}}</span>
由于包裹问题,我不想使用[(ngModel)]
。
我想使用[]和()传统方式。
现在,问题是在selectedRadioButtonValue中没有改变值。这是什么问题?
export class EmployeeComponent {
selectedRadioButtonValue: string = "All";
}