@@ -24,6 +24,8 @@ import {
24
24
ViewChild ,
25
25
ViewEncapsulation ,
26
26
NgZone ,
27
+ Optional ,
28
+ Inject ,
27
29
} from '@angular/core' ;
28
30
import { ControlValueAccessor , NG_VALUE_ACCESSOR } from '@angular/forms' ;
29
31
import {
@@ -39,6 +41,7 @@ import {
39
41
mixinTabIndex ,
40
42
RippleRef ,
41
43
} from '@angular/material/core' ;
44
+ import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations' ;
42
45
43
46
// Increasing integer for generating unique ids for slide-toggle components.
44
47
let nextUniqueId = 0 ;
@@ -77,6 +80,7 @@ export const _MatSlideToggleMixinBase =
77
80
'[class.mat-checked]' : 'checked' ,
78
81
'[class.mat-disabled]' : 'disabled' ,
79
82
'[class.mat-slide-toggle-label-before]' : 'labelPosition == "before"' ,
83
+ '[class._mat-animation-noopable]' : '_animationMode === "NoopAnimations"' ,
80
84
} ,
81
85
templateUrl : 'slide-toggle.html' ,
82
86
styleUrls : [ 'slide-toggle.css' ] ,
@@ -167,7 +171,8 @@ export class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestro
167
171
private _focusMonitor : FocusMonitor ,
168
172
private _changeDetectorRef : ChangeDetectorRef ,
169
173
@Attribute ( 'tabindex' ) tabIndex : string ,
170
- private _ngZone : NgZone ) {
174
+ private _ngZone : NgZone ,
175
+ @Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) public _animationMode ?: string ) {
171
176
172
177
super ( elementRef ) ;
173
178
this . tabIndex = parseInt ( tabIndex ) || 0 ;
0 commit comments