Nesting Routes

Routes allow you to structure data in views. Like folders, nested routes group together related routes under a base URL. It is helpful to think of parent routes as representing nouns and child routes as representing verbs or adjectives:

// Parent route is noun
this.route('sightings', function() {
  // Child route is verb or adjective
  this.route('new');
});

sightings is a parent route representing sightings, which are things (nouns), and new is a nested route representing the action of creating a sighting (a verb). this.route is used to build up the URL including the parent and child.

With template nesting, parts of your site can be rendered on all routes (such as navigation), while others will only show on more ...

Get Front-End Web Development: The Big Nerd Ranch Guide 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.