O'Reilly logo

Mastering Ember.js by Mitchel Kelonye

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Defining route links

A typical Ember.js application has several routes that we might need to link to in templates. The {{#link-to}}...{{/link-to}} helper serves this purpose and lets the application create anchors to these routes easily. For example, the list on the left-hand side of our sample application is composed of links that the user can use to view the details of the various contacts. We use this helper to generate these links as:

  <ul class="nav nav-pills nav-stacked">
  {{#each model}}
  <li>
    {{#link-to "contact.index" this}}{{name}}{{/link-to}}
  </li>
  {{/each}}
</ul>

If we inspect one of the generated links, we notice that it resembles the following line of code:

<a href="#/contacts/1">Jon Doe</a>

The helper takes the route name as the first ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required