@@ -20,6 +20,7 @@ import {
20
20
Renderer2 ,
21
21
} from '@angular/core' ;
22
22
import { ThemePalette , mixinDisabled , CanDisableCtor , CanDisable } from '@angular/material/core' ;
23
+ import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations' ;
23
24
24
25
25
26
let nextId = 0 ;
@@ -128,9 +129,10 @@ export class MatBadge extends _MatBadgeMixinBase implements OnDestroy, CanDisabl
128
129
private _elementRef : ElementRef < HTMLElement > ,
129
130
private _ariaDescriber : AriaDescriber ,
130
131
/** @breaking -change 8.0.0 Make _renderer a required param and remove _document. */
131
- private _renderer ?: Renderer2 ) {
132
- super ( ) ;
133
- }
132
+ private _renderer ?: Renderer2 ,
133
+ @Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) private _animationMode ?: string ) {
134
+ super ( ) ;
135
+ }
134
136
135
137
/** Whether the badge is above the host or not */
136
138
isAbove ( ) : boolean {
@@ -180,14 +182,18 @@ export class MatBadge extends _MatBadgeMixinBase implements OnDestroy, CanDisabl
180
182
badgeElement . classList . add ( 'mat-badge-content' ) ;
181
183
badgeElement . textContent = this . content ;
182
184
185
+ if ( this . _animationMode === 'NoopAnimations' ) {
186
+ badgeElement . classList . add ( '_mat-animation-noopable' ) ;
187
+ }
188
+
183
189
if ( this . description ) {
184
190
badgeElement . setAttribute ( 'aria-label' , this . description ) ;
185
191
}
186
192
187
193
this . _elementRef . nativeElement . appendChild ( badgeElement ) ;
188
194
189
195
// animate in after insertion
190
- if ( typeof requestAnimationFrame === 'function' ) {
196
+ if ( typeof requestAnimationFrame === 'function' && this . _animationMode !== 'NoopAnimations' ) {
191
197
this . _ngZone . runOutsideAngular ( ( ) => {
192
198
requestAnimationFrame ( ( ) => {
193
199
badgeElement . classList . add ( activeClass ) ;
0 commit comments