1

私のObjectController:

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 に答える