@@ -41,6 +41,7 @@ import {
41
41
} from '@angular/material/core' ;
42
42
import { Subject } from 'rxjs' ;
43
43
import { take } from 'rxjs/operators' ;
44
+ import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations' ;
44
45
45
46
46
47
/** Represents an event fired on an individual `mat-chip`. */
@@ -105,6 +106,7 @@ export class MatChipTrailingIcon {}
105
106
'[class.mat-chip-with-avatar]' : 'avatar' ,
106
107
'[class.mat-chip-with-trailing-icon]' : 'trailingIcon || removeIcon' ,
107
108
'[class.mat-chip-disabled]' : 'disabled' ,
109
+ '[class._mat-animation-noopable]' : '_animationsDisabled' ,
108
110
'[attr.disabled]' : 'disabled || null' ,
109
111
'[attr.aria-disabled]' : 'disabled.toString()' ,
110
112
'[attr.aria-selected]' : 'ariaSelected' ,
@@ -139,6 +141,9 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
139
141
/** Whether the chip has focus. */
140
142
_hasFocus : boolean = false ;
141
143
144
+ /** Whether animations for the chip are enabled. */
145
+ _animationsDisabled : boolean ;
146
+
142
147
/** Whether the chip list is selectable */
143
148
chipListSelectable : boolean = true ;
144
149
@@ -224,18 +229,21 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
224
229
this . selected . toString ( ) : null ;
225
230
}
226
231
227
- constructor ( public _elementRef : ElementRef ,
232
+ constructor ( public _elementRef : ElementRef < HTMLElement > ,
228
233
private _ngZone : NgZone ,
229
234
platform : Platform ,
230
235
@Optional ( ) @Inject ( MAT_RIPPLE_GLOBAL_OPTIONS )
231
- globalRippleOptions : RippleGlobalOptions | null ) {
236
+ globalRippleOptions : RippleGlobalOptions | null ,
237
+ // @breaking -change 8.0.0 `animationMode` parameter to become required.
238
+ @Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) animationMode ?: string ) {
232
239
super ( _elementRef ) ;
233
240
234
241
this . _addHostClassName ( ) ;
235
242
236
243
this . _chipRipple = new RippleRenderer ( this , _ngZone , _elementRef , platform ) ;
237
244
this . _chipRipple . setupTriggerEvents ( _elementRef . nativeElement ) ;
238
245
this . rippleConfig = globalRippleOptions || { } ;
246
+ this . _animationsDisabled = animationMode === 'NoopAnimations' ;
239
247
}
240
248
241
249
_addHostClassName ( ) {
0 commit comments