Search code examples
ember.jstemplate-engine

ember application.hbs page {{outlet}} not render other page


Ember CLI version 2.7.0

In templates folder I created two files, application.hbs and post.hbs
application.hbs

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

post.hbs

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

I expect "balabala I am from post.hbs" shows in browser, however I can only see "balabala".
Anybody could help? Thanks.


Solution

  • Make sure you've added the new route in your router.js file.

    this.route('post');
    

    Plus you will have to add a new post route. Easiest is to user ember cli to generate the files for you in the future.

    ember generate route post
    
    
    Result :
    installing
      create app/routes/post.js
      create app/templates/post.hbs
    installing
      create tests/unit/routes/post-test.js