我正在使用 ember.select。我试图动态设置值。但这对我不起作用。我附上了我的示例代码。
帮我解决这个问题。
这是我的车把模板 Hbs:-
{{view Ember.Select
contentBinding="dropDown"
optionValuePath="content.id"
optionLabelPath="content.value"
selectionBinding="obj3" //This is the object am trying to set dynamically. I defined my object in below
}}
//View Model - This is my view model. This model gives the dropdown list
App.MyModel = Em.Object.extend({
id:{
},
dropDown:[
{id:"1",value:"test1"},
{id:"2",value:"test2"},
{id:"3",value:"test3"}
]
});
// Model - Here is my data model. I want to update obj3 with dropdown list value.
DataModel = Em.Object.extend({
obj1:"",
obj2:"",
obj3:null
});
// Create obj. Initially am trying to set default value for my dropdown.
var dataModel = DataModel.create({
obj1:"value1",
obj2:"value1",
obj3:{id:"1",value:"test1"}
})