什么控制 Ember 加载路线的显示位置? [英] What controls where Ember's Loading Route is displayed?

查看:15
本文介绍了什么控制 Ember 加载路线的显示位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我本以为 LoadingRoute 会在主 AppView 的 {{outlet}} 中显示其模板,但似乎并非如此.什么决定了它的去向?

I would have thought that the LoadingRoute would display its template in the {{outlet}} of the main AppView, but it doesn't seem like it does. What determines where it goes?

这是我的问题的 JS Bin.Loading 消息未显示在我预期的位置.

Here's a JS Bin of my problem. The Loading message isn't showing up where I expect.

推荐答案

假设你有这个映射:

App.Router.map(function() {
  this.route("foo")
});

何时过渡到 foo 路由.它将插入在 render 方法的 into 属性中指定的模板中.举例:

When is transitioned to foo route. It template will be inserted in that was specified in the into property of render method. By example:

App.FooRoute = Ember.Route.extend({
    renderTemplate: function() {
      this.render("foo", { into: "sometemplate" })
    }
});

如果没有设置,foo 路由将检索父路由,在这种情况下为 ApplicationRoute,并将模板 foo 插入到 application 模板.这是不覆盖 renderTemplate 方法时的默认行为.

Case this isn't setted, the foo route will retrieve the parent route, in that case ApplicationRoute, and insert the template foo, into application template. This is the default behavior when you don't override the renderTemplate method.

但是当没有任何一种情况发生时,这就是 LoadingRoute 的行为,因为它没有 ApplicationRoute 作为父级.比 ember 在 body 标签中插入模板,或者更具体地说在 App.rootElement 中.

But when no one of that conditions happens, this is the behavior of LoadingRoute, because it doesn't have the ApplicationRoute as parent. Than ember insert the template in the body tag, or more specifically in App.rootElement.

这篇关于什么控制 Ember 加载路线的显示位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆