@@ -50,6 +50,11 @@ export interface MatProgressSpinnerDefaultOptions {
5050 diameter ?: number ;
5151 /** Width of the spinner's stroke. */
5252 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 ;
5358}
5459
5560/** Injection token to be used to override the default options for `mat-progress-spinner`. */
@@ -102,7 +107,7 @@ const INDETERMINATE_ANIMATION_TEMPLATE = `
102107 host : {
103108 'role' : 'progressbar' ,
104109 'class' : 'mat-progress-spinner' ,
105- '[class._mat-animation-noopable]' : `_animationMode === 'NoopAnimations' ` ,
110+ '[class._mat-animation-noopable]' : `_noopAnimations ` ,
106111 '[style.width.px]' : 'diameter' ,
107112 '[style.height.px]' : 'diameter' ,
108113 '[attr.aria-valuemin]' : 'mode === "determinate" ? 0 : null' ,
@@ -131,6 +136,10 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
131136 */
132137 private static styleTag : HTMLStyleElement | null = null ;
133138
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+
134143 /** The diameter of the progress spinner (will set width and height of svg). */
135144 @Input ( )
136145 get diameter ( ) : number { return this . _diameter ; }
@@ -167,10 +176,10 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
167176 constructor ( public _elementRef : ElementRef ,
168177 platform : Platform ,
169178 @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 ,
172181 @Inject ( MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS )
173- defaults ?: MatProgressSpinnerDefaultOptions ) {
182+ private defaults ?: MatProgressSpinnerDefaultOptions ) {
174183
175184 super ( _elementRef ) ;
176185 this . _fallbackAnimation = platform . EDGE || platform . TRIDENT ;
@@ -269,7 +278,7 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
269278 'role' : 'progressbar' ,
270279 'mode' : 'indeterminate' ,
271280 'class' : 'mat-spinner mat-progress-spinner' ,
272- '[class._mat-animation-noopable]' : `_animationMode === 'NoopAnimations' ` ,
281+ '[class._mat-animation-noopable]' : `_noopAnimations ` ,
273282 '[style.width.px]' : 'diameter' ,
274283 '[style.height.px]' : 'diameter' ,
275284 } ,
0 commit comments