Exercise: Implementing Routing

Apply what you’ve learned about routing in Marionette and enable the route to go back to our main page/root URL by using a link.

Getting back to the contacts list

When the user is on a contact’s display page, e.g., #contacts/2, there’s no way for them to return to the page listing all contacts, i.e., #contacts. Add a simple link to the contact page template (#contact-view) that will take the user to the page listing all contacts.

Note: We’re not including this feature within the main code, because we’re going to implement a full-featured menu later. With the navigation header in place, there will be no need for this link on a contact’s page.

Write your solution under the comments provided below in the following files:

  • index.html

  • show_view.js

Code playground

Get hands-on with 1400+ tech skills courses.