3

我正在尝试设置 Ember 路由器应用程序,但我无法使用 Controller 对象的 connectOulet 方法将视图连接到特定插座(具有名称的插座,即:){{outlet outletName}}。我已经建立了一个 JSFiddle 示例,有人可以告诉我我做错了什么或如何实际去做吗?

JSFiddle:http: //jsfiddle.net/TmKwd/

4

1 回答 1

6

嗯,我不能准确解释为什么,但是不能将ApplicationController定义为Ember.ObjectController,而只能定义为Ember.Controller。

更新

经过快速调试后,这是在 applicationController 上调用 connectOutlet 时,尤其是行set(this, outletName, view);
As outletName(在您的示例中,这是“一”和“二”)是 applicationController 中的未知属性,并且由于您将 applicationController 定义为 ObjectController (所以是包装内容属性的代理),Ember.js 尝试在内容上设置视图,这是未定义/空的。

结果,抛出此错误:

Uncaught Error: assertion failed: Cannot delegate set('one', <App.ViewOneView:ember208>) to the 'content' property of object proxy <App.ApplicationController:ember209>: its 'content' is undefined.

于 2012-12-28T09:27:57.697 回答