2012-07-31 33 views

回答

2

我猜你的意思selectionBinding,並將其綁定對象,以便使用{{App.power.label}}

<script type="text/x-handlebars"> 
    App Power : {{#if App.power}}{{App.power.label}}{{else}}Not yet set{{/if}} 
    <hr/> 
     {{view Ember.Select 
     contentBinding="App.booleanOptions" 
     selectionBinding="App.power" 
     optionLabelPath="content.label" 
     optionValuePath="content.value" 
     id="emberEnhanced" 
     }} 
</script> 
+2

+1,僅供參考,您可以通過將App.power初始化爲null來避免模板中的if語句。 http://jsfiddle.net/rDpEG/2/ – 2012-07-31 21:16:58

+0

這是一個有用的信息,我沒有注意到:) – sabithpocker 2012-07-31 21:28:26

1

看起來像我詢問一個尚未公佈的功能。當前版本爲0.9.8.1,valueBinding爲中繼

+0

順便說一句,你檢查了我的答案?用這個小提琴來說明http://jsfiddle.net/rDpEG/1/ – sabithpocker 2012-07-31 21:03:47