Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在Ember中选择默认单选按钮? {{input type=“radio”name=“customerFacing”value=report.customerFacing id=“customerFacingYes”change=(action“customerFacingChange”“yes”)}yes_Javascript_Ember.js - Fatal编程技术网

Javascript 如何在Ember中选择默认单选按钮? {{input type=“radio”name=“customerFacing”value=report.customerFacing id=“customerFacingYes”change=(action“customerFacingChange”“yes”)}yes

Javascript 如何在Ember中选择默认单选按钮? {{input type=“radio”name=“customerFacing”value=report.customerFacing id=“customerFacingYes”change=(action“customerFacingChange”“yes”)}yes,javascript,ember.js,Javascript,Ember.js,如果变量“report.customerFacing”为真或假,我试图将单选按钮设置为选中。我是否可以用javascript编写一些东西来将其设置为选中状态 谢谢您的代码将适用于复选框 {{input type="radio" name="customerFacing" value=report.customerFacing id="customerFacingYes" change=(action "customerFacingChange" "yes")}}<label for="cu

如果变量“report.customerFacing”为真或假,我试图将单选按钮设置为选中。我是否可以用javascript编写一些东西来将其设置为选中状态


谢谢

您的代码将适用于复选框

{{input type="radio" name="customerFacing" value=report.customerFacing id="customerFacingYes" change=(action "customerFacingChange" "yes")}}<label for="customerFacingYes">Yes</label>

您必须创建自定义组件,请检查此处
{{input type="checkbox" name="customerFacing"  checked=report.customerFacing value=report.customerFacing id="customerFacingYes" on-change=(action (mut report.customerFacingChange) checked)}} 
<label for="customerFacingYes">{{report.customerFacing}}</label>
ember install ember-radio-button

{{#radio-button value=report.customerFacing groupValue=report.customerFacing class="cpntr" changed=(action "customerFacingChange")}}
      <label for="customerFacingYes">{{report.customerFacing}}</label>
 {{/radio-button}}
actions: {
 customerFacingChange(newValue){
  console.log('Changed value'+newValue); //you can do other stuff here.
 }
}