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