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.
This commit is contained in:
Kristiyan Kostadinov
2018-11-07 18:25:22 +00:00
committed by vivian-hu
parent 2290063ec8
commit 4ce5ee0a6c
+2 -1
View File
@@ -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) : ''
};
}