2014-10-05 105 views
1

當視圖編輯模式我可以顯示我的所有選項的值和標籤,問題是,我不能達到同樣的,當灰燼選擇視圖是在可編輯模式下。選項選擇編輯

下面的代碼在事:

App.ThreadsController=Ember.ArrayController.extend({ 

    selectContentTariffa: null, 

    selectContentTariffa: [ 
    {label: "180", value: "180"}, 
    {label: "200", value: "200"}, 
    {label: "300", value: "300"} 
    ], 
在我的編輯模式圖,其中我不能在我的視圖中顯示的選項

{{#if editable}} 
<td>{{view Ember.Select prompt="Tariffa" content=selectContentTariffa optionValuePath="content.value" optionLabelPath="content.label" selectionBinding="selectContentTariffa" valueBinding="content.label"}}</td> 

時,它不是編輯並正確顯示的選項

<td>{{view Ember.Select prompt="Tariffa" content=selectContentTariffa optionValuePath="content.value" optionLabelPath="content.label"}}</td> 

這裏有一個jsbin在重現問題的行動:http://jsbin.com/begopu/19/edit

回答

1

您的範圍在您的範圍內發生了變化,因此控制器不再是this,這意味着您無權訪問其屬性。您可以通過使用each item in model允許控制器緩解這一/這還是在範圍上和你迭代的項目將作用域爲item

例子:http://jsbin.com/jumem/1/edit