1

我的对象控制器:

App.TestController = Ember.ObjectController.extend
  content: null

App.testController = App.TestController.create()
App.testController.set("content", Ember.Object.create({ question: "Question?" }))

console.log App.testController.get("question")

我的观点:

{{#view App.QuizView controller="App.testController"}}
   <div>"{{question}}"</div>
{{/view}}

在我的控制台上,我得到:

Question?

但我的观点是空的:

""

我究竟做错了什么?

4

1 回答 1

3

问题来自您的模板,您没有将控制器绑定到视图。代替

{{#view App.QuizView controller="App.testController"}}

{{#view App.QuizView controllerBinding="App.testController"}}

您可以在此 JSFiddle 中尝试此解决方案。

于 2012-10-10T10:15:17.303 回答