fix: nav
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user