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' ;
2
2
import { NavigationStart , Route , Router , RouterLinkActive , RouterLink , RouterOutlet } from '@angular/router' ;
3
3
import { IgxNavigationDrawerComponent , IgxTreeComponent , IgxLayoutDirective , IgxNavDrawerTemplateDirective , IgxNavDrawerItemDirective , IgxRippleDirective , IgxIconComponent , IgxInputGroupComponent , IgxPrefixDirective , IgxInputDirective , IgxSuffixDirective , IgxTreeNodeComponent , IgxTreeNodeLinkDirective , IgxFlexDirective , IgxNavbarComponent } from 'igniteui-angular' ;
4
4
import { fromEvent , Subscription } from 'rxjs' ;
@@ -19,6 +19,7 @@ import { servicesRoutesData } from '../services/services-routes-data';
19
19
import { themingRoutesData } from '../theming/theming-routes-data' ;
20
20
import { treeGridRoutesData } from '../tree-grid/tree-grid-routes-data' ;
21
21
import { FormsModule } from '@angular/forms' ;
22
+ import { isPlatformBrowser } from '@angular/common' ;
22
23
23
24
24
25
@@ -32,6 +33,7 @@ export class IndexComponent implements OnInit, AfterViewInit {
32
33
private router = inject ( Router ) ;
33
34
private cdr = inject ( ChangeDetectorRef ) ;
34
35
private document = inject < Document > ( DOCUMENT ) ;
36
+ private platformId = inject ( PLATFORM_ID ) ;
35
37
36
38
37
39
@ViewChild ( 'navdrawer' , { read : IgxNavigationDrawerComponent , static : true } )
@@ -168,7 +170,7 @@ export class IndexComponent implements OnInit, AfterViewInit {
168
170
const loadedRouteItem = this . appRoutes . filter (
169
171
( route : any ) => route . path === this . router . url ) [ 0 ] ;
170
172
171
- if ( loadedRouteItem ) {
173
+ if ( loadedRouteItem && isPlatformBrowser ( ( this . platformId ) ) ) {
172
174
// Get parent (INavItem)
173
175
const loadedParentItem = this . currentNavItems . filter (
174
176
( navItem ) => navItem . name === loadedRouteItem . parentName ) [ 0 ] ;
0 commit comments