1- import { AfterViewInit , ChangeDetectorRef , Component , OnInit , ViewChild , DOCUMENT , inject } from '@angular/core' ;
1+ import { AfterViewInit , ChangeDetectorRef , Component , OnInit , ViewChild , DOCUMENT , PLATFORM_ID , inject } from '@angular/core' ;
22import { NavigationStart , Route , Router , RouterLinkActive , RouterLink , RouterOutlet } from '@angular/router' ;
33import { IgxNavigationDrawerComponent , IgxTreeComponent , IgxLayoutDirective , IgxNavDrawerTemplateDirective , IgxNavDrawerItemDirective , IgxRippleDirective , IgxIconComponent , IgxInputGroupComponent , IgxPrefixDirective , IgxInputDirective , IgxSuffixDirective , IgxTreeNodeComponent , IgxTreeNodeLinkDirective , IgxFlexDirective , IgxNavbarComponent } from 'igniteui-angular' ;
44import { fromEvent , Subscription } from 'rxjs' ;
@@ -19,6 +19,7 @@ import { servicesRoutesData } from '../services/services-routes-data';
1919import { themingRoutesData } from '../theming/theming-routes-data' ;
2020import { treeGridRoutesData } from '../tree-grid/tree-grid-routes-data' ;
2121import { FormsModule } from '@angular/forms' ;
22+ import { isPlatformBrowser } from '@angular/common' ;
2223
2324
2425
@@ -32,6 +33,7 @@ export class IndexComponent implements OnInit, AfterViewInit {
3233 private router = inject ( Router ) ;
3334 private cdr = inject ( ChangeDetectorRef ) ;
3435 private document = inject < Document > ( DOCUMENT ) ;
36+ private platformId = inject ( PLATFORM_ID ) ;
3537
3638
3739 @ViewChild ( 'navdrawer' , { read : IgxNavigationDrawerComponent , static : true } )
@@ -168,7 +170,7 @@ export class IndexComponent implements OnInit, AfterViewInit {
168170 const loadedRouteItem = this . appRoutes . filter (
169171 ( route : any ) => route . path === this . router . url ) [ 0 ] ;
170172
171- if ( loadedRouteItem ) {
173+ if ( loadedRouteItem && isPlatformBrowser ( ( this . platformId ) ) ) {
172174 // Get parent (INavItem)
173175 const loadedParentItem = this . currentNavItems . filter (
174176 ( navItem ) => navItem . name === loadedRouteItem . parentName ) [ 0 ] ;
0 commit comments