This commit is contained in:
eneller
2026-04-03 08:47:39 +02:00
parent 4f8da032b7
commit 38dedfc829
4 changed files with 24 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
import { Component, signal } from '@angular/core';
import { RouterOutlet, RouterLinkWithHref } from '@angular/router';
import { Component, OnInit, signal } from '@angular/core';
import { RouterOutlet, RouterLinkWithHref, Router, NavigationEnd } from '@angular/router';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import {
NgbNav,
@@ -7,6 +7,7 @@ import {
NgbNavItemRole,
NgbNavLinkBase,
} from '@ng-bootstrap/ng-bootstrap/nav';
import { filter } from 'rxjs';
@Component({
selector: 'app-root',
@@ -14,8 +15,21 @@ import {
templateUrl: './app.html',
styleUrl: './app.less'
})
export class App {
export class App implements OnInit{
protected readonly title = signal('client');
//FIXME nav jumping back to 1 after reload
active = 1;
active = '/';
constructor(
private router: Router
){}
ngOnInit(): void {
this.router.events
.pipe(filter(event => event instanceof NavigationEnd))
.subscribe(() =>{
this.active = this.router.url;
console.log(this.active);
});
}
}