File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ import {
2222 OnDestroy ,
2323 Output ,
2424 ViewChild ,
25- ViewEncapsulation
25+ ViewEncapsulation ,
26+ NgZone ,
2627} from '@angular/core' ;
2728import { ControlValueAccessor , NG_VALUE_ACCESSOR } from '@angular/forms' ;
2829import {
@@ -144,7 +145,8 @@ export class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestro
144145 private _platform : Platform ,
145146 private _focusMonitor : FocusMonitor ,
146147 private _changeDetectorRef : ChangeDetectorRef ,
147- @Attribute ( 'tabindex' ) tabIndex : string ) {
148+ @Attribute ( 'tabindex' ) tabIndex : string ,
149+ private _ngZone : NgZone ) {
148150
149151 super ( elementRef ) ;
150152 this . tabIndex = parseInt ( tabIndex ) || 0 ;
@@ -274,9 +276,11 @@ export class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestro
274276 this . _emitChangeEvent ( ) ;
275277 }
276278
277- // The drag should be stopped outside of the current event handler, because otherwise the
278- // click event will be fired before and will revert the drag change.
279- setTimeout ( ( ) => this . _slideRenderer . stopThumbDrag ( ) ) ;
279+ // The drag should be stopped outside of the current event handler, otherwise the
280+ // click event will be fired before it and will revert the drag change.
281+ this . _ngZone . runOutsideAngular ( ( ) => {
282+ setTimeout ( ( ) => this . _slideRenderer . stopThumbDrag ( ) ) ;
283+ } ) ;
280284 }
281285 }
282286
You can’t perform that action at this time.
0 commit comments