简体   繁体   English

EmberJS | 如何在application.hbs中加载插座

[英]EmberJS | How is outlet loaded inside application.hbs

I am new to EmberJS, Can someone please explain how EmberJS loads the outlet inside application.hbs? 我是EmberJS的新手,有人可以解释一下EmberJS如何在application.hbs中加载插座吗?

I know application.hbs is the starting point, from where the router.js will invoked that will call the default resource. 我知道application.hbs是起点,从该起点将调用router.js,它将调用默认资源。 I am lost on how the default resource loads another template into the applcation.hbs. 我不知道默认资源如何将另一个模板加载到applcation.hbs中。

Read this from the url: http://thetechcofounder.com/getting-started-with-ember-js-using-ember-cli/ 请从以下网址阅读: http : //thetechcofounder.com/getting-started-with-ember-js-using-ember-cli/

A router resource [essentially current url path ] is linked to a template. 路由器资源[本质上是当前的URL路径]链接到模板。 So the moment that resource is encountered, ember brings in the template that is specified with the router resource and replaces the outlet in the application template. 因此,在遇到资源的那一刻,ember将引入路由器资源指定的模板,并替换应用程序模板中的出口。

You seem quite confused. 您似乎很困惑。 I suggest going through the Ember guide again. 我建议再次阅读Ember指南。

I know application.hbs is the starting point 我知道application.hbs是起点

No, it's the template rendered by the top-level route. 不,这是顶层路线呈现的模板。

from where router.js will invoked that will call the default resource router.js调用的地方调用默认资源

Templates do not invoke routes, they are rendered by routes. 模板不调用路由,而是由路由呈现。

I am lost on how the default resource loads another template into the applcation.hbs. 我不知道默认资源如何将另一个模板加载到applcation.hbs中。

When you visit a route, that route's template is rendered into an outlet in the template corresponding to a higher-level route. 当您访问一条路线时,该路线的模板会呈现到该模板中与更高级别路线相对应的插座中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM