Skip to content

Commit

Permalink
Fix prerender test issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jwshinjwshin committed Aug 31, 2017
1 parent 4118f4e commit e446bef
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/lib/slider/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ export class MdSlider extends _MdSliderMixinBase
/** The value of the slider when the slide start event fires. */
private _valueOnSlideStart: number | null;

/** Whether the component has been initialized. */
private _initialized = false;

/** Reference to the inner slider wrapper element. */
@ViewChild('sliderWrapper') private _sliderWrapper: ElementRef;

Expand All @@ -414,10 +417,16 @@ export class MdSlider extends _MdSliderMixinBase
.monitor(this._elementRef.nativeElement, renderer, true)
.subscribe((origin: FocusOrigin) => {
this._isActive = !!origin && origin !== 'keyboard';
this._changeDetectorRef.detectChanges();
if (this._initialized) {
this._changeDetectorRef.detectChanges();
}
});
if (_dir) {
_dir.change.subscribe(() => this._changeDetectorRef.markForCheck());
}

ngOnInit() {
this._initialized = true;
if (this._dir) {
this._dir.change.subscribe(() => this._changeDetectorRef.markForCheck());
}
}

Expand Down

0 comments on commit e446bef

Please sign in to comment.