1- import { ChangeDetectionStrategy , Component , EventEmitter , Input , Output } from '@angular/core' ;
1+ import { ChangeDetectionStrategy , Component , EventEmitter , Input , OnChanges , Output } from '@angular/core' ;
22import { ActivatedRoute } from '@angular/router' ;
33import { IconType } from '@hypertrace/assets-library' ;
44import { Color , NavigationService } from '@hypertrace/common' ;
@@ -25,7 +25,7 @@ import { IconSize } from '../icon/icon-size';
2525 <hr *ngSwitchCase="'${ NavItemType . Divider } '" class="nav-divider" />
2626
2727 <ng-container *ngSwitchCase="'${ NavItemType . Link } '">
28- <ht-nav-item [config]="item" [active]="item === activeItem" [collapsed]="this.collapsed"> </ht-nav-item>
28+ <ht-nav-item [config]="item" [active]="item === activeItem" [collapsed]="this.collapsed"></ht-nav-item>
2929 </ng-container>
3030 </ng-container>
3131 </ng-container>
@@ -48,7 +48,7 @@ import { IconSize } from '../icon/icon-size';
4848 </nav>
4949 `
5050} )
51- export class NavigationListComponent {
51+ export class NavigationListComponent implements OnChanges {
5252 @Input ( )
5353 public navItems : NavItemConfig [ ] = [ ] ;
5454
@@ -64,12 +64,14 @@ export class NavigationListComponent {
6464 @Output ( )
6565 public readonly collapsedChange : EventEmitter < boolean > = new EventEmitter ( ) ;
6666
67- public readonly activeItem$ : Observable < NavItemLinkConfig | undefined > ;
67+ public activeItem$ ? : Observable < NavItemLinkConfig | undefined > ;
6868
6969 public constructor (
7070 private readonly navigationService : NavigationService ,
7171 private readonly activatedRoute : ActivatedRoute
72- ) {
72+ ) { }
73+
74+ public ngOnChanges ( ) : void {
7375 this . activeItem$ = this . navigationService . navigation$ . pipe (
7476 startWith ( this . navigationService . getCurrentActivatedRoute ( ) ) ,
7577 map ( ( ) => this . findActiveItem ( this . navItems ) )
0 commit comments