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 {
22
22
OnDestroy ,
23
23
Output ,
24
24
ViewChild ,
25
- ViewEncapsulation
25
+ ViewEncapsulation ,
26
+ NgZone ,
26
27
} from '@angular/core' ;
27
28
import { ControlValueAccessor , NG_VALUE_ACCESSOR } from '@angular/forms' ;
28
29
import {
@@ -144,7 +145,8 @@ export class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestro
144
145
private _platform : Platform ,
145
146
private _focusMonitor : FocusMonitor ,
146
147
private _changeDetectorRef : ChangeDetectorRef ,
147
- @Attribute ( 'tabindex' ) tabIndex : string ) {
148
+ @Attribute ( 'tabindex' ) tabIndex : string ,
149
+ private _ngZone : NgZone ) {
148
150
149
151
super ( elementRef ) ;
150
152
this . tabIndex = parseInt ( tabIndex ) || 0 ;
@@ -274,9 +276,11 @@ export class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestro
274
276
this . _emitChangeEvent ( ) ;
275
277
}
276
278
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
+ } ) ;
280
284
}
281
285
}
282
286
You can’t perform that action at this time.
0 commit comments