@@ -107,8 +107,8 @@ const _MatChipMixinBase:
107
107
'[class.mat-mdc-chip-highlighted]' : 'highlighted' ,
108
108
'[class.mat-mdc-chip-with-avatar]' : 'leadingIcon' ,
109
109
'[class.mat-mdc-chip-with-trailing-icon]' : 'trailingIcon || removeIcon' ,
110
- '[class.mat-mdc-basic-chip]' : '_isBasicChip() ' ,
111
- '[class.mat-mdc-standard-chip]' : '!_isBasicChip() ' ,
110
+ '[class.mat-mdc-basic-chip]' : '_isBasicChip' ,
111
+ '[class.mat-mdc-standard-chip]' : '!_isBasicChip' ,
112
112
'[class._mat-animation-noopable]' : '_animationsDisabled' ,
113
113
'[id]' : 'id' ,
114
114
'[attr.disabled]' : 'disabled || null' ,
@@ -133,6 +133,9 @@ export class MatChip extends _MatChipMixinBase implements AfterContentInit, Afte
133
133
134
134
readonly HANDLED_KEYS : number [ ] = [ ] ;
135
135
136
+ /** Whether this chip is a basic (unstyled) chip. */
137
+ readonly _isBasicChip : boolean ;
138
+
136
139
/** Whether the chip has focus. */
137
140
protected _hasFocusInternal = false ;
138
141
@@ -316,6 +319,9 @@ export class MatChip extends _MatChipMixinBase implements AfterContentInit, Afte
316
319
super ( _elementRef ) ;
317
320
this . _chipFoundation = new MDCChipFoundation ( this . _chipAdapter ) ;
318
321
this . _animationsDisabled = animationMode === 'NoopAnimations' ;
322
+ this . _isBasicChip = _elementRef . nativeElement . hasAttribute ( this . basicChipAttrName ) ||
323
+ _elementRef . nativeElement . tagName . toLowerCase ( ) === this . basicChipAttrName ;
324
+
319
325
}
320
326
321
327
ngAfterContentInit ( ) {
@@ -382,13 +388,6 @@ export class MatChip extends _MatChipMixinBase implements AfterContentInit, Afte
382
388
}
383
389
}
384
390
385
- /** Whether this chip is a basic (unstyled) chip. */
386
- _isBasicChip ( ) {
387
- const element = this . _elementRef . nativeElement as HTMLElement ;
388
- return element . hasAttribute ( this . basicChipAttrName ) ||
389
- element . tagName . toLowerCase ( ) === this . basicChipAttrName ;
390
- }
391
-
392
391
/** Sets whether the given CSS class should be applied to the MDC chip. */
393
392
private _setMdcClass ( cssClass : string , active : boolean ) {
394
393
const classes = this . _elementRef . nativeElement . classList ;
@@ -405,7 +404,7 @@ export class MatChip extends _MatChipMixinBase implements AfterContentInit, Afte
405
404
406
405
/** Whether or not the ripple should be disabled. */
407
406
_isRippleDisabled ( ) : boolean {
408
- return this . disabled || this . disableRipple || this . _isBasicChip ( ) ;
407
+ return this . disabled || this . disableRipple || this . _isBasicChip ;
409
408
}
410
409
411
410
static ngAcceptInputType_disabled : BooleanInput ;
0 commit comments