Skip to content

Commit 4ce5ee0

Browse files
crisbetovivian-hu-zz
authored andcommitted
fix(icon): account for query params when prefixing external references (#13930)
Fixes `mat-icon` ignoring query params when prefixing external references inside the SVG. Fixes #13924.
1 parent 2290063 commit 4ce5ee0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib/icon/icon.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ export interface MatIconLocation {
5959
/** @docs-private */
6060
export function MAT_ICON_LOCATION_FACTORY(): MatIconLocation {
6161
const _document = inject(DOCUMENT);
62+
const _location = _document ? _document.location : null;
6263

6364
return {
6465
// Note that this needs to be a function, rather than a property, because Angular
6566
// will only resolve it once, but we want the current path on each call.
66-
getPathname: () => (_document && _document.location && _document.location.pathname) || ''
67+
getPathname: () => _location ? (_location.pathname + _location.search) : ''
6768
};
6869
}
6970

0 commit comments

Comments
 (0)