Skip to content

fix(progress-bar): account for query params when prefixing references #13942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/lib/progress-bar/progress-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ export interface MatProgressBarLocation {
/** @docs-private */
export function MAT_PROGRESS_BAR_LOCATION_FACTORY(): MatProgressBarLocation {
const _document = inject(DOCUMENT);
const _location = _document ? _document.location : null;

return {
// Note that this needs to be a function, because Angular will only instantiate
// this provider once, but we want the current location on each call.
getPathname: () => (_document && _document.location && _document.location.pathname) || ''
// 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: () => _location ? (_location.pathname + _location.search) : ''
};
}

Expand Down