0

是否可以使用模板作为selectionBinding值?这是我正在尝试做的事情:

控制器:

App.testController = Em.Object.create({
    content:[
       {title: "abc", index: 1, model: App.s1 },
       {title: "def", index: 2, model: App.s2 }
     ]
}}

看法:

{{#each App.testController.content}}
  Title: {{title}} Model: {{model}} Index: {{index}}
  {{view Ember.Select
       // doesn't work
       selectionBinding="App.s" + {{index}}" + ".selected"
       contentBinding="App.s" + {{index}} + ".content"
  }}
}}

换句话说,迭代中的每个视图都需要绑定到它自己的模型,因此上述语法的任何变体都将受到欢迎。我尝试使用[]语法,但也.get({{index})没有任何成功。

在 a 之后我到底可以使用selectionBinding=什么?

4

1 回答 1

0

绑定字符串只能使用字符串属性路径。

在您的示例中,最好绑定到model.selectedand model.content

于 2012-09-27T02:28:27.540 回答