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 30, 2017
1 parent 4118f4e commit ba7dffd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion 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,13 +417,19 @@ 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;
}

ngOnDestroy() {
this._focusOriginMonitor.stopMonitoring(this._elementRef.nativeElement);
if (this._dir) {
Expand Down

0 comments on commit ba7dffd

Please sign in to comment.