Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 821 Bytes

File metadata and controls

42 lines (29 loc) · 821 Bytes

Navigating

Aurelia provides several ways to navigate between routes:

Programmatic Navigation

Use the router.navigate() method:

this.router.navigate('users');

You can also pass parameters:

this.router.navigate('users/42');

Or use named routes with parameters:

this.router.navigateToRoute('userDetail', { id: 42 });

Declarative Navigation

In your templates, you can use the route-href attribute:

<a route-href="route: users">Users</a>
<a route-href="route: userDetail; params.bind: { id: user.id }">View User</a>

You can also use the router-view element's route attribute for creating navigation menus:

<ul>
  <li repeat.for="nav of router.navigation">
    <a href.bind="nav.href">${nav.title}</a>
  </li>
</ul>