From debe82afdb515c604d321a8e140c347e4eb518e5 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 21 Oct 2025 03:26:04 +0200 Subject: [PATCH] Update navigation links in Home and Shell components; add child routes for test and test2 --- src/angular/frontend/src/app/app.routes.ts | 29 +++++++++++++++++++ .../app/components/home/home.component.html | 5 ++-- .../app/components/shell/shell.component.html | 2 +- .../app/components/shell/shell.component.ts | 4 +-- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/angular/frontend/src/app/app.routes.ts b/src/angular/frontend/src/app/app.routes.ts index 7e5f923..82c414e 100644 --- a/src/angular/frontend/src/app/app.routes.ts +++ b/src/angular/frontend/src/app/app.routes.ts @@ -31,6 +31,35 @@ export const routes: Routes = [ title: 'Test', path: 'test', component: HomeComponent, + children: [ + { + title: 'Test A', + path: 'testa', + component: HomeComponent, + }, + { + title: 'Test B', + path: 'testb', + component: HomeComponent, + } + ] + }, + { + title: 'Test2', + path: 'test2', + component: HomeComponent, + children: [ + { + title: 'Test A', + path: 'testa', + component: HomeComponent, + }, + { + title: 'Test B', + path: 'testb', + component: HomeComponent, + } + ] } ] }, diff --git a/src/angular/frontend/src/app/components/home/home.component.html b/src/angular/frontend/src/app/components/home/home.component.html index c4dd070..cff4407 100644 --- a/src/angular/frontend/src/app/components/home/home.component.html +++ b/src/angular/frontend/src/app/components/home/home.component.html @@ -1,6 +1,5 @@ -test -

home works!

-

home works!

+

test - testa - testb

+

test2 - testa - testb

home works!

home works!

home works!

diff --git a/src/angular/frontend/src/app/components/shell/shell.component.html b/src/angular/frontend/src/app/components/shell/shell.component.html index 21e2c33..21e2043 100644 --- a/src/angular/frontend/src/app/components/shell/shell.component.html +++ b/src/angular/frontend/src/app/components/shell/shell.component.html @@ -23,7 +23,7 @@ @for (crumb of breadcrumbs(); let last = $last; track crumb.label) { @if (crumb.url && !last) { - {{ crumb.label }} + {{ crumb.label }} } @else { {{ crumb.label }} } diff --git a/src/angular/frontend/src/app/components/shell/shell.component.ts b/src/angular/frontend/src/app/components/shell/shell.component.ts index 8a5c17f..e5c5bd1 100644 --- a/src/angular/frontend/src/app/components/shell/shell.component.ts +++ b/src/angular/frontend/src/app/components/shell/shell.component.ts @@ -59,12 +59,10 @@ export class ShellComponent implements OnInit { private initBreadcrumbs() { this.breadcrumbs.set(this.buildBreadcrumbs(this.route.root)); - console.log('breadcrumbs', this.breadcrumbs()); } private initNavigation() { this.navLinks.set(this.extractNavLinks(this.router.config)); - console.log('navLinks', this.navLinks()) } private extractNavLinks(routes: Route[]): Breadcrumb[] { @@ -89,7 +87,7 @@ export class ShellComponent implements OnInit { const routeURL = child.snapshot.url.map(segment => segment.path).join('/'); if (routeURL) { - url += `${routeURL}`; + url += !url.endsWith('/') ? `/${routeURL}` : `${routeURL}`; } const label =