@@ -15,6 +15,8 @@ import {
15
15
OnDestroy ,
16
16
ViewChild ,
17
17
ViewEncapsulation ,
18
+ Optional ,
19
+ Inject ,
18
20
} from '@angular/core' ;
19
21
import {
20
22
CanColor ,
@@ -25,6 +27,7 @@ import {
25
27
mixinDisabled ,
26
28
mixinDisableRipple
27
29
} from '@angular/material/core' ;
30
+ import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations' ;
28
31
29
32
/** Default color palette for round buttons (mat-fab and mat-mini-fab) */
30
33
const DEFAULT_ROUND_BUTTON_COLOR = 'accent' ;
@@ -65,6 +68,7 @@ export const _MatButtonMixinBase = mixinColor(mixinDisabled(mixinDisableRipple(M
65
68
exportAs : 'matButton' ,
66
69
host : {
67
70
'[disabled]' : 'disabled || null' ,
71
+ '[class._mat-animation-noopable]' : '_animationMode === "NoopAnimations"' ,
68
72
} ,
69
73
templateUrl : 'button.html' ,
70
74
styleUrls : [ 'button.css' ] ,
@@ -91,7 +95,9 @@ export class MatButton extends _MatButtonMixinBase
91
95
*/
92
96
// tslint:disable-next-line:no-unused-variable
93
97
private _platform : Platform ,
94
- private _focusMonitor : FocusMonitor ) {
98
+ private _focusMonitor : FocusMonitor ,
99
+ // @deletion -target 7.0.0 `_animationMode` parameter to be made required.
100
+ @Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) public _animationMode ?: string ) {
95
101
super ( elementRef ) ;
96
102
97
103
// For each of the variant selectors that is prevent in the button's host
@@ -147,6 +153,7 @@ export class MatButton extends _MatButtonMixinBase
147
153
'[attr.disabled]' : 'disabled || null' ,
148
154
'[attr.aria-disabled]' : 'disabled.toString()' ,
149
155
'(click)' : '_haltDisabledEvents($event)' ,
156
+ '[class._mat-animation-noopable]' : '_animationMode === "NoopAnimations"' ,
150
157
} ,
151
158
inputs : [ 'disabled' , 'disableRipple' , 'color' ] ,
152
159
templateUrl : 'button.html' ,
@@ -156,8 +163,13 @@ export class MatButton extends _MatButtonMixinBase
156
163
} )
157
164
export class MatAnchor extends MatButton {
158
165
159
- constructor ( platform : Platform , focusMonitor : FocusMonitor , elementRef : ElementRef ) {
160
- super ( elementRef , platform , focusMonitor ) ;
166
+ constructor (
167
+ platform : Platform ,
168
+ focusMonitor : FocusMonitor ,
169
+ elementRef : ElementRef ,
170
+ // @deletion -target 7.0.0 `animationMode` parameter to be made required.
171
+ @Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) animationMode ?: string ) {
172
+ super ( elementRef , platform , focusMonitor , animationMode ) ;
161
173
}
162
174
163
175
_haltDisabledEvents ( event : Event ) {
0 commit comments