1- import { ChangeDetectorRef , Component , Input , OnDestroy , OnInit } from '@angular/core' ;
1+ import { ChangeDetectorRef , Component , Inject , Input , OnDestroy , OnInit , PLATFORM_ID } from '@angular/core' ;
22
33import { TranslateService } from '@ngx-translate/core' ;
44
55import { hasValue } from '../empty.util' ;
66import { environment } from '../../../environments/environment' ;
77import { AlertType } from '../alert/alert-type' ;
88import { Router } from '@angular/router' ;
9- import { Location } from '@angular/common' ;
9+ import { isPlatformBrowser , Location } from '@angular/common' ;
1010
1111enum MessageType {
1212 LOADING = 'loading' ,
@@ -33,7 +33,6 @@ export class LoadingComponent implements OnDestroy, OnInit {
3333 @Input ( ) errorMessageDelay = environment . loader . errorMessageDelay ;
3434 errorTimeoutWithRetriesDelay = environment . loader . errorMessageDelay ;
3535
36-
3736 @Input ( ) numberOfAutomaticPageReloads = environment . loader . numberOfAutomaticPageReloads || 0 ;
3837
3938 /**
@@ -52,6 +51,7 @@ export class LoadingComponent implements OnDestroy, OnInit {
5251 readonly AlertTypeEnum = AlertType ;
5352
5453 constructor (
54+ @Inject ( PLATFORM_ID ) public platformId : any ,
5555 private router : Router ,
5656 private location : Location ,
5757 private translate : TranslateService ,
@@ -77,7 +77,7 @@ export class LoadingComponent implements OnDestroy, OnInit {
7777 this . message = this . message || this . translate . instant ( 'loading.default' ) ;
7878 }
7979
80- if ( this . showFallbackMessages ) {
80+ if ( this . showFallbackMessages && isPlatformBrowser ( this . platformId ) ) {
8181 this . warningMessage = this . warningMessage || this . translate . instant ( 'loading.warning' ) ;
8282 this . errorMessage = this . errorMessage || this . translate . instant ( 'loading.error' ) ;
8383
0 commit comments