Step 2: Routing + nested layouts
Add primary routes, a Projects layout, and nested child routes.
In this step you will create the root pages and a Projects layout that hosts child routes.
1. Create the dashboard
Create src/pages/dashboard-page.ts:
export class DashboardPage {}Create src/pages/dashboard-page.html:
<import from="../components/app-shell"></import>
<app-shell>
<h1 au-slot="title">Dashboard</h1>
<a au-slot="actions" load="../projects">View Projects</a>
<p>Welcome to Project Pulse. Use the Projects page to manage tasks.</p>
</app-shell>Note: Links inside routed components are resolved relative to the current route. Use ../ when you want to navigate to a sibling at the parent level.
2. Create placeholder child pages
We will build these pages in later steps, but we need the files now so the routes can resolve.
Create src/pages/projects-overview-page.ts:
Create src/pages/projects-overview-page.html:
Create src/pages/projects-activity-page.ts:
Create src/pages/projects-activity-page.html:
3. Create the Projects layout with child routes
Create src/pages/projects-page.ts:
Create src/pages/projects-page.html:
The nested <au-viewport> is where the Overview and Activity pages render.
4. Wire up the root routes
Update src/my-app.ts:
Update src/my-app.html:
Notice the is-active class when you navigate between Dashboard and Projects.
Next step: Step 3: Overview page + filters + events
Last updated
Was this helpful?