Skip to content

Commit aa250d4

Browse files
authored
fix(snackbar): don't use template string in metadata (#1550)
1 parent 4086b32 commit aa250d4

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

src/demo-app/snack-bar/snack-bar-demo.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,3 @@ export class SnackBarDemo {
2020
this.snackBar.open(this.message, this.action && this.actionButtonLabel, config);
2121
}
2222
}
23-
24-
25-
@Component({
26-
moduleId: module.id,
27-
selector: 'demo-snack',
28-
templateUrl: 'snack-bar-demo.html',
29-
styleUrls: ['./snack-bar-demo.css'],
30-
})
31-
export class DemoSnack {}

src/lib/snack-bar/snack-bar-container.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import {
1515
ComponentPortal,
1616
TemplatePortal,
1717
PortalHostDirective,
18-
AnimationCurves,
19-
AnimationDurations,
2018
} from '../core';
2119
import {MdSnackBarConfig} from './snack-bar-config';
2220
import {MdSnackBarContentAlreadyAttached} from './snack-bar-errors';
@@ -27,6 +25,11 @@ import {Subject} from 'rxjs/Subject';
2725

2826
export type SnackBarState = 'initial' | 'visible' | 'complete' | 'void';
2927

28+
// TODO(jelbourn): we can't use constants from animation.ts here because you can't use
29+
// a text interpolation in anything that is analyzed statically with ngc (for AoT compile).
30+
export const SHOW_ANIMATION = '225ms cubic-bezier(0.4,0.0,1,1)';
31+
export const HIDE_ANIMATION = '195ms cubic-bezier(0.0,0.0,0.2,1)';
32+
3033
/**
3134
* Internal component that wraps user-provided snack bar content.
3235
*/
@@ -45,10 +48,8 @@ export type SnackBarState = 'initial' | 'visible' | 'complete' | 'void';
4548
state('initial', style({transform: 'translateY(100%)'})),
4649
state('visible', style({transform: 'translateY(0%)'})),
4750
state('complete', style({transform: 'translateY(100%)'})),
48-
transition('visible => complete',
49-
animate(`${AnimationDurations.EXITING} ${AnimationCurves.DECELERATION_CURVE}`)),
50-
transition('initial => visible, void => visible',
51-
animate(`${AnimationDurations.ENTERING} ${AnimationCurves.ACCELERATION_CURVE}`)),
51+
transition('visible => complete', animate(HIDE_ANIMATION)),
52+
transition('initial => visible, void => visible', animate(SHOW_ANIMATION)),
5253
])
5354
],
5455
})

0 commit comments

Comments
 (0)