1- import { Component , OnInit , ViewChild } from '@angular/core' ;
1+ import { Component , inject , OnInit , PLATFORM_ID , ViewChild } from '@angular/core' ;
22import {
33 IgxTreeGridComponent ,
44 IgxColumnComponent ,
@@ -20,7 +20,7 @@ import {
2020 THEME_TOKEN ,
2121 ThemeToken ,
2222} from 'igniteui-angular' ;
23- import { CommonModule } from '@angular/common' ;
23+ import { CommonModule , isPlatformBrowser } from '@angular/common' ;
2424import { BehaviorSubject } from 'rxjs' ;
2525import { DataService } from '../services/data.service' ;
2626@Component ( {
@@ -61,6 +61,7 @@ export class HrPortalComponent implements OnInit {
6161 public isLoading = true ;
6262 @ViewChild ( 'treeGrid' , { read : IgxTreeGridComponent , static : true } )
6363 public treeGrid ! : IgxTreeGridComponent ;
64+ private platformId = inject ( PLATFORM_ID ) ;
6465
6566 constructor ( private iconService : IgxIconService , private dataService : DataService ) { }
6667
@@ -75,63 +76,65 @@ export class HrPortalComponent implements OnInit {
7576 const icons = [
7677 {
7778 name : 'linkedIn' ,
78- path : '/ images/others/linkedin.svg' ,
79+ path : 'images/others/linkedin.svg' ,
7980 category : 'hr-icons' ,
8081 } ,
8182 {
8283 name : 'USA' ,
83- path : '/ images/countries/United States.svg' ,
84+ path : 'images/countries/United States.svg' ,
8485 category : 'country-icons' ,
8586 } ,
8687 {
8788 name : 'CAN' ,
88- path : '/ images/countries/Canada.svg' ,
89+ path : 'images/countries/Canada.svg' ,
8990 category : 'country-icons' ,
9091 } ,
9192 {
9293 name : 'GBR' ,
93- path : '/ images/countries/United Kingdom.svg' ,
94+ path : 'images/countries/United Kingdom.svg' ,
9495 category : 'country-icons' ,
9596 } ,
9697 {
9798 name : 'DEU' ,
98- path : '/ images/countries/Germany.svg' ,
99+ path : 'images/countries/Germany.svg' ,
99100 category : 'country-icons' ,
100101 } ,
101102 {
102103 name : 'FRA' ,
103- path : '/ images/countries/France.svg' ,
104+ path : 'images/countries/France.svg' ,
104105 category : 'country-icons' ,
105106 } ,
106107 {
107108 name : 'ESP' ,
108- path : '/ images/countries/Spain.svg' ,
109+ path : 'images/countries/Spain.svg' ,
109110 category : 'country-icons' ,
110111 } ,
111112 {
112113 name : 'ITA' ,
113- path : '/ images/countries/Italy.svg' ,
114+ path : 'images/countries/Italy.svg' ,
114115 category : 'country-icons' ,
115116 } ,
116117 {
117118 name : 'AUS' ,
118- path : '/ images/countries/Australia.svg' ,
119+ path : 'images/countries/Australia.svg' ,
119120 category : 'country-icons' ,
120121 } ,
121122 {
122123 name : 'JPN' ,
123- path : '/ images/countries/Japan.svg' ,
124+ path : 'images/countries/Japan.svg' ,
124125 category : 'country-icons' ,
125126 } ,
126127 {
127128 name : 'ARE' ,
128- path : '/ images/countries/uae.svg' ,
129+ path : 'images/countries/uae.svg' ,
129130 category : 'country-icons' ,
130131 } ,
131132 ] ;
132133
133- icons . forEach ( ( icon ) => {
134- this . iconService . addSvgIcon ( icon . name , icon . path , icon . category ) ;
135- } ) ;
134+ if ( isPlatformBrowser ( this . platformId ) ) {
135+ icons . forEach ( ( icon ) => {
136+ this . iconService . addSvgIcon ( icon . name , icon . path , icon . category ) ;
137+ } ) ;
138+ }
136139 }
137140}
0 commit comments