关于emberjs中命名约定的困惑

也许有些人只知道答案,但我想了解以下内容:

假设您正在声明一个观点:

App.FooView = Ember.View.extend({});

现在,在App.Router引用此视图App.Router导致以下错误:

router.get('applicationController').connectOutlet('Foo')

当我引用Foo时,控制台指出: Uncaught Error: assertion failed: The name you supplied Foo did not resolve to a controller FooController

我无法在解释args的文档中找到任何地方。 也许投降的人实际上可以为解决方案做出贡献。

连接sockets时,路由器会查找控制器和视图,其名称与提供的名称相同。 在您列出的示例中,路由器正在寻找FooController和FooView,并且没有找到控制器。 如果要指定更多详细信息,可以使用视图,控制器和上下文传递选项对象,如下所示:

 router.get('applicationController').connectOutlet( { outletName: 'master', controller: 'fooController', view: 'fooView', context: data }); 

从文档:

 connectOutlet: function(name, context) { // Normalize arguments. Supported arguments: // // name // name, context // outletName, name // outletName, name, context // options // // The options hash has the following keys: // // name: the name of the controller and view // to use. If this is passed, the name // determines the view and controller. // outletName: the name of the outlet to // fill in. default: 'view' // viewClass: the class of the view to instantiate // controller: the controller instance to pass // to the view // context: an object that should become the // controller's `content` and thus the // template's context. 

编辑:语法和代码格式