Component Configured Routing
Working with the hybrid approach to routing, configure routing from within components.
import { customElement, IPlatform } from 'aurelia';
import { IRouteViewModel, routes } from 'aurelia-direct-router';
import template from './user-profile.html';
@routes([
{ id: 'info', path: '', component: UserInfoCustomElement, title: 'Profile' },
{ path: 'items', component: UserItemsCustomElement, title: 'Profile' },
])
@customElement({ name: 'user-profile', template })
export class UserProfileCustomElement implements IRouteViewModel {
}<div class="user-profile-container">
<ul>
<li class="nav-item">
<a class="nav-link" load="info;>
My Info
</a>
</li>
<li class="nav-item">
<a class="nav-link" load="route:items;>
My Items
</a>
</li>
</ul>
<au-viewport></au-viewport>
</div>Last updated