1- import { ApplicationConfig } from '@angular/core' ;
1+ import { ApplicationConfig , Injectable } from '@angular/core' ;
22import {
33 provideRouter ,
44 withComponentInputBinding ,
@@ -9,17 +9,19 @@ import { provideHttpClient, withFetch } from '@angular/common/http';
99import { provideClientHydration } from '@angular/platform-browser' ;
1010import { provideAnimations } from '@angular/platform-browser/animations' ;
1111
12- import { provideFastSVG } from '@push-based/ngx-fast-svg' ;
12+ import { provideFastSVG , SvgLoadStrategyImpl } from '@push-based/ngx-fast-svg' ;
1313import { provideAngularSvgIcon } from 'angular-svg-icon' ;
1414import { provideIonicAngular } from '@ionic/angular/standalone' ;
1515
1616import { appRoutes } from './app.routes' ;
17- import { map , Observable , timer } from 'rxjs' ;
17+ import { Observable , of , switchMap , timer } from 'rxjs' ;
1818
19- class LoaderStrategy {
20- load ( name : string ) : Observable < string > {
21- return timer ( 1000 ) . pipe ( map ( ( ) => `assets/svg-icons/${ name } .svg` ) )
22- } ;
19+ @Injectable ( { providedIn : 'root' } )
20+ export class ConfigService extends SvgLoadStrategyImpl {
21+ lazy$ = timer ( 10_000 )
22+ override config ( url : string ) : Observable < string > {
23+ return this . lazy$ . pipe ( switchMap ( ( ) => of ( url ) ) )
24+ }
2325}
2426
2527export const appConfig : ApplicationConfig = {
@@ -39,7 +41,8 @@ export const appConfig: ApplicationConfig = {
3941 provideAngularSvgIcon ( ) ,
4042 provideIonicAngular ( { } ) ,
4143 provideFastSVG ( {
42- url : ( name : string ) => timer ( 10000 ) . pipe ( map ( ( ) => `assets/svg-icons/${ name } .svg` ) ) ,
44+ url : ( name : string ) => `assets/svg-icons/${ name } .svg` ,
45+ svgLoadStrategy : ConfigService
4346 } ) ,
4447 ] ,
4548} ;
0 commit comments