我使用成员-cli,并希望选择绑定值
{{view Ember.Select
content=industries
value=industryId
optionValuePath="content.id"
optionLabelPath="content.name"}}内线I支援工业
var industries= [];
Ember.$.getJSON('/api/v1/Industry',function(items){
items.forEach(function(item) {
industries.pushObject({id:item.id,name:item.name});
});
});
controller.set('industries', industries); 我有动态模型,从服务器返回,属性'industryId‘返回2,但是在id=1中总是有选定的元素
更新
{{view Ember.Select
content=industries
value=2
optionValuePath="content.id"
optionLabelPath="content.name"
}}但仍未被选中
发布于 2014-07-21 16:59:56
如果要设置默认的"select“选项,请添加”提示“属性:
{{view Ember.Select
content=industries
value=industryId
optionValuePath="content.id"
optionLabelPath="content.name"
prompt="Please Select One"}}发布于 2014-07-21 18:03:58
如果视图中存在属性industryId,则必须使用industryId而不是仅使用industryId。如果它已经存在于控制器中,而您仍然没有得到它,那么您将使用valueBinding="industryId"而不是value=industryId
https://stackoverflow.com/questions/24870236
复制相似问题