Skip to content

fix(progress-bar): generate correct url on server #12813

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 3 commits into from
Aug 27, 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
8 changes: 6 additions & 2 deletions src/lib/progress-bar/progress-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import {
Input,
Optional,
ViewEncapsulation,
InjectionToken
InjectionToken,
inject,
} from '@angular/core';
import {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';
import {CanColor, mixinColor} from '@angular/material/core';
import {DOCUMENT} from '@angular/common';

// TODO(josephperrott): Benchpress tests.
// TODO(josephperrott): Add ARIA attributes for progress bar "for".
Expand Down Expand Up @@ -49,7 +51,9 @@ export interface MatProgressBarLocation {

/** @docs-private */
export function MAT_PROGRESS_BAR_LOCATION_FACTORY(): MatProgressBarLocation {
return typeof window !== 'undefined' ? window.location : {pathname: ''};
const _document = inject(DOCUMENT);
const pathname = (_document && _document.location && _document.location.pathname) || '';
return {pathname};
}


Expand Down