Skip to content

fix(material-experimental/progress-bar): server-side rendering error #17359

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
Oct 11, 2019
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/material-experimental/mdc-progress-bar/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ng_module(
module_name = "@angular/material-experimental/mdc-progress-bar",
deps = [
"//src/cdk/bidi",
"//src/cdk/platform",
"//src/material/core",
"//src/material/progress-bar",
"@npm//@angular/core",
Expand Down
5 changes: 4 additions & 1 deletion src/material-experimental/mdc-progress-bar/progress-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {MDCLinearProgressAdapter, MDCLinearProgressFoundation} from '@material/l
import {Subscription, fromEvent, Observable} from 'rxjs';
import {filter} from 'rxjs/operators';
import {Directionality} from '@angular/cdk/bidi';
import {Platform} from '@angular/cdk/platform';

// Boilerplate for applying mixins to MatProgressBar.
/** @docs-private */
Expand Down Expand Up @@ -63,6 +64,7 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements AfterVie

constructor(public _elementRef: ElementRef<HTMLElement>,
private _ngZone: NgZone,
private _platform: Platform,
@Optional() private _dir?: Directionality,
@Optional() @Inject(ANIMATION_MODULE_TYPE) public _animationMode?: string) {
super(_elementRef);
Expand Down Expand Up @@ -189,7 +191,8 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements AfterVie
private _syncFoundation() {
const foundation = this._foundation;

if (foundation) {
// Don't sync any state if we're not in a browser, because MDC uses some window APIs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you file an issue on their repo?

if (foundation && this._platform.isBrowser) {
const direction = this._dir ? this._dir.value : 'ltr';
const mode = this.mode;

Expand Down