1
如果select是multipe = false,它將起作用。如果我們將其更改爲multiple = true,則綁定停止工作。當選擇multipe = true時,Emberjs Binding停止工作
http://jsfiddle.net/6Evrq/163/
App = Ember.Application.create();
App.Router.map(function() {
// put your routes here
});
App.IndexController = Ember.ObjectController.extend({
selectedServiceFlavours: Ember.computed.defaultTo('serviceFlavours.firstObject.myvalue'),
serviceFlavours: function(){
return [
{name: "1 (1)", myvalue: "1"},
{name: "2 (2)", myvalue: "2"},
{name: "3 (3)", myvalue: "3"}
];
}.property(),
});
和選擇:
{{view Ember.Select content=serviceFlavours optionLabelPath="content.name" optionValuePath="content.myvalue" value=selectedServiceFlavours multiple=true }} selected: {{selectedServiceFlavours}}
遺憾的是不支持多選擇'value'財產。 http://emberjs.com/api/classes/Ember.Select.html#property_value – 2014-10-09 19:22:37
謝謝,所以我必須使用選擇,如何保持內容更改時的默認選擇? http://jsfiddle.net/taLgt1md/4/ – Pedro4441 2014-10-10 09:19:58