@@ -50,6 +50,11 @@ export interface MatProgressSpinnerDefaultOptions {
50
50
diameter ?: number ;
51
51
/** Width of the spinner's stroke. */
52
52
strokeWidth ?: number ;
53
+ /**
54
+ * Whether the animations should be force to be enabled, ignoring if the current environment is
55
+ * using NoopAnimationsModule.
56
+ */
57
+ _forceAnimations ?: boolean ;
53
58
}
54
59
55
60
/** Injection token to be used to override the default options for `mat-progress-spinner`. */
@@ -102,7 +107,7 @@ const INDETERMINATE_ANIMATION_TEMPLATE = `
102
107
host : {
103
108
'role' : 'progressbar' ,
104
109
'class' : 'mat-progress-spinner' ,
105
- '[class._mat-animation-noopable]' : `_animationMode === 'NoopAnimations' ` ,
110
+ '[class._mat-animation-noopable]' : `_noopAnimations ` ,
106
111
'[style.width.px]' : 'diameter' ,
107
112
'[style.height.px]' : 'diameter' ,
108
113
'[attr.aria-valuemin]' : 'mode === "determinate" ? 0 : null' ,
@@ -131,6 +136,10 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
131
136
*/
132
137
private static styleTag : HTMLStyleElement | null = null ;
133
138
139
+ /** Whether the _mat-animation-noopable class should be applied, disabling animations. */
140
+ _noopAnimations : boolean = this . animationMode === 'NoopAnimations' && (
141
+ ! ! this . defaults && ! this . defaults . _forceAnimations ) ;
142
+
134
143
/** The diameter of the progress spinner (will set width and height of svg). */
135
144
@Input ( )
136
145
get diameter ( ) : number { return this . _diameter ; }
@@ -167,10 +176,10 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
167
176
constructor ( public _elementRef : ElementRef ,
168
177
platform : Platform ,
169
178
@Optional ( ) @Inject ( DOCUMENT ) private _document : any ,
170
- // @deletion -target 7.0.0 _animationMode and defaults parameters to be made required.
171
- @Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) public _animationMode ?: string ,
179
+ // @deletion -target 7.0.0 animationMode and defaults parameters to be made required.
180
+ @Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) private animationMode ?: string ,
172
181
@Inject ( MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS )
173
- defaults ?: MatProgressSpinnerDefaultOptions ) {
182
+ private defaults ?: MatProgressSpinnerDefaultOptions ) {
174
183
175
184
super ( _elementRef ) ;
176
185
this . _fallbackAnimation = platform . EDGE || platform . TRIDENT ;
@@ -269,7 +278,7 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
269
278
'role' : 'progressbar' ,
270
279
'mode' : 'indeterminate' ,
271
280
'class' : 'mat-spinner mat-progress-spinner' ,
272
- '[class._mat-animation-noopable]' : `_animationMode === 'NoopAnimations' ` ,
281
+ '[class._mat-animation-noopable]' : `_noopAnimations ` ,
273
282
'[style.width.px]' : 'diameter' ,
274
283
'[style.height.px]' : 'diameter' ,
275
284
} ,
0 commit comments