gpt4 book ai didi

javascript - Emberjs 索引与应用程序

转载 作者:行者123 更新时间:2023-11-30 18:03:38 28 4
gpt4 key购买 nike

我无法理解或找到适当的文档来详细说明 Emberjs 的“应用程序”和“索引” View / Controller /模板。它们可以互换吗?

例如,

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

当我导航到根 URL 时,它呈现“应用程序”模板并且上下文是“应用程序” Controller - 同时,我特别命名了资源索引。我的期望是它随后会使用“IndexView”和“IndexController”。

任何人都可以澄清这些事情或为我指出良好文档的方向吗?

最佳答案

我认为您错过了“导出”的概念,无法完全理解正在发生的事情。

在您的应用程序中,资源通过名为 outlet 的注入(inject)点注入(inject)到应用程序模板中。

只需在您的应用程序模板中添加 {{outlet}}。

请在此处查看文档 http://emberjs.com/guides/application/the-application-template/

关于javascript - Emberjs 索引与应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16320278/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com