关于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.
编辑:语法和代码格式
- Ember Engines通过ember-cli-rails在Rails引擎内部
- Rails:不是ember,不是JS响应,而是介于两者之间
- 使用qunit测试emberjs / rails / devise应用程序时“无法validationCSRF令牌真实性”
- Ember Handling 401s于2015年重访
- 如何使用Ember Data&Rails在单个Ember.js表单中保留hasMany关联?
- emberjs和foundation4
- Rails RoutingError(没有路由匹配
- Ember.js基于会话cookie的Rails和设计认证
- 可以在一个Rails应用程序中拥有多个ember.js应用程序吗?