From 4ce5ee0a6cf74cb8ff9c1de3bd5064c860df6f84 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Wed, 7 Nov 2018 18:25:22 +0000 Subject: [PATCH] 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. --- src/lib/icon/icon.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/icon/icon.ts b/src/lib/icon/icon.ts index 13002a2b557..56283d82b7e 100644 --- a/src/lib/icon/icon.ts +++ b/src/lib/icon/icon.ts @@ -59,11 +59,12 @@ export interface MatIconLocation { /** @docs-private */ export function MAT_ICON_LOCATION_FACTORY(): MatIconLocation { const _document = inject(DOCUMENT); + const _location = _document ? _document.location : null; return { // Note that this needs to be a function, rather than a property, because Angular // will only resolve it once, but we want the current path on each call. - getPathname: () => (_document && _document.location && _document.location.pathname) || '' + getPathname: () => _location ? (_location.pathname + _location.search) : '' }; }