Defining routes with templates
Another job of the route handler is rendering the appropriate template. Here is a recipe that goes over this.
How to do it...
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 ...
Get Ember.js Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.