1- import { Component , ElementRef , Inject , Input } from '@angular/core' ;
1+ import { Component , ElementRef , Inject , Input , PLATFORM_ID } from '@angular/core' ;
22import { Item } from '../../../core/shared/item.model' ;
33import { Observable } from 'rxjs' ;
44import { RemoteData } from '../../../core/data/remote-data' ;
@@ -7,8 +7,9 @@ import { ViewMode } from '../../../core/shared/view-mode.model';
77import { RelationshipDataService } from '../../../core/data/relationship-data.service' ;
88import { AbstractIncrementalListComponent } from '../abstract-incremental-list/abstract-incremental-list.component' ;
99import { FindListOptions } from '../../../core/data/find-list-options.model' ;
10- import { setPlaceHolderFontSize } from '../../../shared/utils/object-list-utils' ;
10+ import { setPlaceHolderAttributes } from '../../../shared/utils/object-list-utils' ;
1111import { APP_CONFIG , AppConfig } from '../../../../config/app-config.interface' ;
12+ import { isPlatformBrowser } from '@angular/common' ;
1213
1314@Component ( {
1415 selector : 'ds-related-items' ,
@@ -63,15 +64,20 @@ export class RelatedItemsComponent extends AbstractIncrementalListComponent<Obse
6364
6465 constructor ( public relationshipService : RelationshipDataService ,
6566 protected elementRef : ElementRef ,
66- @Inject ( APP_CONFIG ) protected appConfig : AppConfig
67+ @Inject ( APP_CONFIG ) protected appConfig : AppConfig ,
68+ @Inject ( PLATFORM_ID ) private platformId : Object
6769 ) {
6870 super ( ) ;
6971 this . fetchThumbnail = this . appConfig . browseBy . showThumbnails ;
7072 }
7173
7274 ngOnInit ( ) : void {
73- const width = this . elementRef . nativeElement . offsetWidth ;
74- this . placeholderFontClass = setPlaceHolderFontSize ( width ) ;
75+ if ( isPlatformBrowser ( this . platformId ) ) {
76+ const width = this . elementRef . nativeElement . offsetWidth ;
77+ this . placeholderFontClass = setPlaceHolderAttributes ( width ) ;
78+ } else {
79+ this . placeholderFontClass = 'hide-placeholder-text' ;
80+ }
7581 super . ngOnInit ( ) ;
7682 }
7783
0 commit comments