Another job of the route handler is rendering the appropriate template. Here is a recipe that goes over this.
In this recipe, we'll create a few nested routes and check where they get rendered.
In a new project, create a new
students
andschools
route:$ ember g route schools $ ember g route schools/students
This will create the nested
students
andschools
route.Let's take a look at the
router.js
file:// app/router.js import Ember from 'ember'; import config from './config/environment'; var Router = Ember.Router.extend({ location: config.locationType }); Router.map(function() { this.route('schools', {}, function() { this.route('students', {}); }); }); export default Router;
The generated command already created the routes that we need. The
schools
route has a nested route calledstudents
.By convention, the route will render the template with the same name. Therefore, the
schools
route will render to theschools.hbs
file while thestudents...