ember application.hbs页面{{outlet}}不呈现其他页面

时间:2016-08-27 01:05:40

标签: ember.js template-engine

Ember CLI版本2.7.0

在模板文件夹中,我创建了两个文件,application.hbs和post.hbs
application.hbs

<h2 id="title">balabala</h2>
{{outlet}}

post.hbs

<h3>I am from post.hbs</h3>

我希望“balabala我来自post.hbs”在浏览器中显示,但我只能看到“balabala”。
有人可以帮忙吗?感谢。

1 个答案:

答案 0 :(得分:1)

确保您已在router.js文件中添加新路线。

this.route('post');

另外,您必须添加新的邮寄路线。 最简单的方法是使用ember cli为将来生成文件。

ember generate route post


Result :
installing
  create app/routes/post.js
  create app/templates/post.hbs
installing
  create tests/unit/routes/post-test.js
相关问题