Ember.js 将余烬模型绑定到无线电场
我有一个简单的输入收音机,可以在活动和非活动之间切换。我想不出如何让余烬将其绑定到模型上。我的原始html当前如下所示:Ember.js 将余烬模型绑定到无线电场,ember.js,Ember.js,我有一个简单的输入收音机,可以在活动和非活动之间切换。我想不出如何让余烬将其绑定到模型上。我的原始html当前如下所示: <fieldset class="checkboxes"> <label class="active" for="is_active"> <input type="radio" id="is_active" name="status" value="1" checked=""> <span>Active</spa
<fieldset class="checkboxes">
<label class="active" for="is_active">
<input type="radio" id="is_active" name="status" value="1" checked="">
<span>Active</span>
<div class="input"></div>
</label>
<label class="sep">/</label>
<label class="inactive" for="inactive">
<input type="radio" id="inactive" value="0" name="status">
<span>Inactive</span>
<div class="input"></div>
</label>
活跃的
/
不活跃的
有人对如何使用余烬表单模型绑定有什么想法吗 使标签动作,这将允许您在控制器中使用标签。我希望这有助于
<fieldset>
<label class="option-buttons" for="reason1" {{action "setDeclineReason" "Too Expensive" on="mouseDown"}}>
<input name="decline-reason" id="reason1" value="Too Expensive" type="radio">
<span>
<div class="check"></div>
Too expensive
</span>
</label>
<label class="option-buttons" for="reason2" {{action "setDeclineReason" "Lack of Amenities" on="mouseDown"}}>
<input name="decline-reason" id="reason2" value="Lack of Amenities" type="radio">
<span>
<div class="check"></div>
Lack of amenities
</span>
</label>
</fieldset>
App.DeclineController = Ember.Controller.extend({
declineReason: null,
decline: function(){
var update = this.store.update('request', {
id: this.get('model').id,
user_decline_reason: this.get('declineReason')
});
update.save();
actions:{
setDeclineReason: function(declineReason){
this.set('declineReason', declineReason);
}
}
});
太贵了
缺乏便利设施
App.DeclineController=Ember.Controller.extend({
declineReason:null,
拒绝:函数(){
var update=this.store.update('请求'{
id:this.get('model').id,
用户\拒绝\原因:this.get('declineReason')
});
update.save();
行动:{
setDeclineReason:函数(declineReason){
此.set('declineReason',declineReason);
}
}
});
我建议您使用Ember单选按钮插件: