@@ -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 ;
@@ -122,9 +123,10 @@ export class MatBadge extends _MatBadgeMixinBase implements OnDestroy, CanDisabl
122
123
private _elementRef : ElementRef < HTMLElement > ,
123
124
private _ariaDescriber : AriaDescriber ,
124
125
/** @breaking -change 8.0.0 Make _renderer a required param and remove _document. */
125
- private _renderer ?: Renderer2 ) {
126
- super ( ) ;
127
- }
126
+ private _renderer ?: Renderer2 ,
127
+ @Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) private _animationMode ?: string ) {
128
+ super ( ) ;
129
+ }
128
130
129
131
/** Whether the badge is above the host or not */
130
132
isAbove ( ) : boolean {
@@ -163,14 +165,18 @@ export class MatBadge extends _MatBadgeMixinBase implements OnDestroy, CanDisabl
163
165
badgeElement . classList . add ( 'mat-badge-content' ) ;
164
166
badgeElement . textContent = this . content ;
165
167
168
+ if ( this . _animationMode === 'NoopAnimations' ) {
169
+ badgeElement . classList . add ( '_mat-animation-noopable' ) ;
170
+ }
171
+
166
172
if ( this . description ) {
167
173
badgeElement . setAttribute ( 'aria-label' , this . description ) ;
168
174
}
169
175
170
176
this . _elementRef . nativeElement . appendChild ( badgeElement ) ;
171
177
172
178
// animate in after insertion
173
- if ( typeof requestAnimationFrame === 'function' ) {
179
+ if ( typeof requestAnimationFrame === 'function' && this . _animationMode !== 'NoopAnimations' ) {
174
180
this . _ngZone . runOutsideAngular ( ( ) => {
175
181
requestAnimationFrame ( ( ) => {
176
182
badgeElement . classList . add ( activeClass ) ;
0 commit comments