1- import { Injectable } from '@angular/core' ;
1+ import { Inject , Injectable , PLATFORM_ID } from '@angular/core' ;
22import { ActivatedRoute , ActivatedRouteSnapshot , Resolve , RouterStateSnapshot } from '@angular/router' ;
3- import { combineLatest as observableCombineLatest , Observable } from 'rxjs' ;
3+ import { combineLatest as observableCombineLatest , Observable , of } from 'rxjs' ;
44import { MenuID } from './shared/menu/menu-id.model' ;
55import { MenuState } from './shared/menu/menu-state.model' ;
66import { MenuItemType } from './shared/menu/menu-item-type.model' ;
@@ -52,9 +52,10 @@ import { environment } from '../environments/environment';
5252import { SectionDataService } from './core/layout/section-data.service' ;
5353import { Section } from './core/layout/models/section.model' ;
5454import { NOTIFICATIONS_RECITER_SUGGESTION_PATH } from './admin/admin-notifications/admin-notifications-routing-paths' ;
55+ import { isPlatformBrowser } from '@angular/common' ;
5556
5657/**
57- * Creates all of the app's menus
58+ * Creates all the app's menus
5859 */
5960@Injectable ( {
6061 providedIn : 'root'
@@ -64,6 +65,7 @@ export class MenuResolver implements Resolve<boolean> {
6465 private activatedRouteLastChild : ActivatedRoute ;
6566
6667 constructor (
68+ @Inject ( PLATFORM_ID ) public platformId : any ,
6769 protected route : ActivatedRoute ,
6870 protected menuService : MenuService ,
6971 protected authorizationService : AuthorizationDataService ,
@@ -77,6 +79,9 @@ export class MenuResolver implements Resolve<boolean> {
7779 * Initialize all menus
7880 */
7981 resolve ( route : ActivatedRouteSnapshot , state : RouterStateSnapshot ) : Observable < boolean > {
82+ if ( ! isPlatformBrowser ( this . platformId ) ) {
83+ return of ( true ) ;
84+ }
8085 return observableCombineLatest ( [
8186 this . createPublicMenu$ ( ) ,
8287 this . createAdminMenu$ ( ) ,
0 commit comments