Emberjs索引vs应用程序

Emberjs Index vs Application

本文关键字:应用程序 vs 索引 Emberjs      更新时间:2023-09-26

我找不到合适的文档来详细说明Emberjs的"application"answers"index"视图/控制器/模板。它们可以互换吗?

例如,

App.Router.map(function(){
  this.resource('index', { path: '/' });
});

当我导航到根URL时,它呈现"应用程序"模板,上下文是"应用程序"控制器-同时,我特别命名了资源Index。我的期望是,它会使用"IndexView"answers"IndexController"。

谁能澄清这些事情或指出好的文档的方向?

我想你错过了"outlet"的概念,无法完全理解发生了什么。

在你的应用中,资源是通过一个叫做outlet的注入点注入到应用模板中的。

只需在你的应用模板中添加{{outlet}}。

查看这里的文档http://emberjs.com/guides/application/the-application-template/