小编Dra*_*scu的帖子

Angular 2单选按钮2路绑定

我有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>
Run Code Online (Sandbox Code Playgroud)

我不想[(ngModel)]因包裹问题而使用.

我想用[]和()传统方式.

现在,问题是在selectedRadioButtonValue中没有改变值.这是什么问题?

export class EmployeeComponent {

selectedRadioButtonValue: string = "All";

}
Run Code Online (Sandbox Code Playgroud)

javascript jquery angular

2
推荐指数
1
解决办法
1245
查看次数

标签 统计

angular ×1

javascript ×1

jquery ×1