3.2 Templates -- The Application Template

1. 当你的应用程序启动时application模板是默认被渲染的的模板。

2. 你应该把你的header, footer和其他任何的装饰内容放到这里。此外,你应该有至少一个{{outlet}}:它是一个占位符,路由器将根据当前的URL填入适当的模板。

3. example:

app/templates/application.hbs

<header>
  <h1>Igor's Blog</h1>
</header>

<div>
  {{outlet}}
</div>

<footer>
  &copy;2013 Igor's Publishing, Inc.
</footer>
  • header, footer将一直被显示在屏幕上,但是<div>中的内容将会根据用户当前的路由发生变化,例如/posts或者/posts/15

4. Ember CLI将会创建为你application.hbs,默认放在app/templates/application.hbs

原文地址:https://www.cnblogs.com/sunshineground/p/5148586.html