什么控制在哪里显示Ember的加载路线? [英] What controls where Ember's Loading Route is displayed?
问题描述
我认为 LoadingRoute
将在主要的 {{outlet}}
中显示其模板AppView,但它似乎不是这样。什么决定了哪里?
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 问题。
推荐答案
假设你有这个映射:
App.Router.map(function() {
this.route("foo")
});
什么时候转换到 foo
路由。该模板将插入到中指定为
属性中。 render
方法的
例如:
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
插入到应用程序
模板中。
当您不覆盖 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
作为父级。或者更详细地在 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屋!