Skip to content

Commit 615b41a

Browse files
committed
fix(lib): use document token to resolve window object
1 parent 34b5906 commit 615b41a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/ngx-fast-lib/src/lib/token/svg-load.strategy.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { from, Observable, of, switchMap } from 'rxjs';
22
import { getZoneUnPatchedApi } from '../internal/get-zone-unpatched-api';
33
import { SvgLoadStrategy } from './svg-load.strategy.model';
4-
import { Injectable } from '@angular/core';
4+
import { DOCUMENT } from '@angular/common';
5+
import { inject, Injectable } from '@angular/core';
56

67
@Injectable()
78
export class SvgLoadStrategyImpl implements SvgLoadStrategy {
8-
fetch = getZoneUnPatchedApi('fetch', window as any);
9+
document = inject(DOCUMENT);
10+
fetch = getZoneUnPatchedApi('fetch', this.document.defaultView as any);
911

1012
load(url$: Observable<string>): Observable<string> {
1113
return url$.pipe(switchMap((url) => {

0 commit comments

Comments
 (0)