Ember.js 无法将单选按钮绑定到视图
我已经把代码贴在这里了。 在这里,我试图将单选按钮(性别)绑定到视图,但我不知道如何执行绑定 在add上,它应该提供选择性别的选项,但目前默认情况下,女性获得select 即使在保存时,它也不会在模型中保存任何数据Ember.js 无法将单选按钮绑定到视图,ember.js,ember-data,Ember.js,Ember Data,我已经把代码贴在这里了。 在这里,我试图将单选按钮(性别)绑定到视图,但我不知道如何执行绑定 在add上,它应该提供选择性别的选项,但目前默认情况下,女性获得select 即使在保存时,它也不会在模型中保存任何数据 male: function(){ return this.get('gender') == 'Male'; }.property('gender') 有谁能帮我做一下以上的工作吗?你可以通过定义一个视图来完成 App.TestView = Ember.View.exten
male: function(){
return this.get('gender') == 'Male';
}.property('gender')
有谁能帮我做一下以上的工作吗?你可以通过定义一个视图来完成
App.TestView = Ember.View.extend({
classNameBindings : ['active'],
attributeBindings : ["value"],
click : function() {
this.set("selection", this.get('value'))
},
active : function() {
return this.get("value") == this.get("selection");
}.property('selection')
}))
这是你的
希望对您有所帮助。您可以通过定义视图来做到这一点
App.TestView = Ember.View.extend({
classNameBindings : ['active'],
attributeBindings : ["value"],
click : function() {
this.set("selection", this.get('value'))
},
active : function() {
return this.get("value") == this.get("selection");
}.property('selection')
}))
这是你的
希望能有帮助