javascript - Emberjs 索引与应用程序

标签 javascript model-view-controller ember.js

我无法理解或找到适当的文档来详细说明 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/

相关文章:

javascript - Vue 不应用样式类

ruby-on-rails - Rails 中的多页表单

ember.js - 使用 JSONAPI 适配器加载带有 ember 数据的蛇形案例字段

jquery - 在 Ember 中渲染模板后执行脚本

ember.js - 复选框值列表作为数组,如 Ember.Select(多个)

javascript - 相当于文本的innerHTML

JavaScript的preventDefault方法在表单验证失败时停止密码保存?

javascript - 如何从回调函数中设置值?

function - Golang MVC结构

php - Model View Controller ......和泛型类?