Switching to a layout template
Even though we passed a template to our Home
route using template: home
, we are not rendering this template dynamically; we are just showing the layout template with its hardcoded subtemplates.
To change this, we need to replace the {{> home}}
inclusion helper inside our layout template with {{> yield}}
.
The {{> yield}}
helper is a placeholder helper provided by iron:router
, where route templates get rendered.
After doing this, when we check out the browser, we shouldn't see any change, as we are still rendering the home
template, but this time dynamically. Then we proceed as follows:
In order to see whether this is true, we will add a not found template to our app, by adding the following template to our
layout.html
file after the layout template:<template name="notFound"> <div class="center"> <h1>Nothing here</h1><br> <h2>You hit a page which doesn't exist!</h2> </div> </template>
Now we...