File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -388,6 +388,9 @@ export class MdSlider extends _MdSliderMixinBase
388
388
/** The value of the slider when the slide start event fires. */
389
389
private _valueOnSlideStart : number | null ;
390
390
391
+ /** Whether the component has been initialized. */
392
+ private _initialized = false ;
393
+
391
394
/** Reference to the inner slider wrapper element. */
392
395
@ViewChild ( 'sliderWrapper' ) private _sliderWrapper : ElementRef ;
393
396
@@ -414,10 +417,16 @@ export class MdSlider extends _MdSliderMixinBase
414
417
. monitor ( this . _elementRef . nativeElement , renderer , true )
415
418
. subscribe ( ( origin : FocusOrigin ) => {
416
419
this . _isActive = ! ! origin && origin !== 'keyboard' ;
417
- this . _changeDetectorRef . detectChanges ( ) ;
420
+ if ( this . _initialized ) {
421
+ this . _changeDetectorRef . detectChanges ( ) ;
422
+ }
418
423
} ) ;
419
- if ( _dir ) {
420
- _dir . change . subscribe ( ( ) => this . _changeDetectorRef . markForCheck ( ) ) ;
424
+ }
425
+
426
+ ngOnInit ( ) {
427
+ this . _initialized = true ;
428
+ if ( this . _dir ) {
429
+ this . _dir . change . subscribe ( ( ) => this . _changeDetectorRef . markForCheck ( ) ) ;
421
430
}
422
431
}
423
432
You can’t perform that action at this time.
0 commit comments