简体   繁体   English

ember.js:是否可以将插座连接到applicationController?

[英]ember.js: is it possible to connect an outlet to applicationController?

Why is it it necessary to always create views and controllers? 为什么必须始终创建视图和控制器? Isn't it possible to say: each view that does not have a specific controller class, falls back to using the applicationController instance, when is being attached as an outlet. 不可能说:每个没有特定控制器类的视图在附加为出口时都退回到使用applicationController实例。

Possible? 可能?

The connectOutlet method has a controller option you can pass: connectOutlet方法具有一个可以传递的controller选项:

postsController.connectOutlet('createPost', { controller: 'application' })

That said, we are in the process of improving the router API in general to put a greater focus on templates and making the View class optional (you'll only need one if you have events to handle). 也就是说,我们通常在改进路由器API的过程中将更多的精力放在模板上,并使View类成为可选类(如果您要处理事件,则只需要一个即可)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM