Skip to content

chore(snack-bar): allow stronger typing for config data #9408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/dialog/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {MatDialogConfig} from './dialog-config';
import {MatDialogContainer} from './dialog-container';
import {MatDialogRef} from './dialog-ref';


/** Injection token that can be used to access the data that was passed in to a dialog. */
export const MAT_DIALOG_DATA = new InjectionToken<any>('MatDialogData');

/** Injection token that can be used to specify default dialog options. */
Expand Down
7 changes: 4 additions & 3 deletions src/lib/snack-bar/snack-bar-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {ViewContainerRef, InjectionToken} from '@angular/core';
import {AriaLivePoliteness} from '@angular/cdk/a11y';
import {Direction} from '@angular/cdk/bidi';

/** Injection token that can be used to access the data that was passed in to a snack bar. */
export const MAT_SNACK_BAR_DATA = new InjectionToken<any>('MatSnackBarData');

/** Possible values for horizontalPosition on MatSnackBarConfig. */
Expand All @@ -21,7 +22,7 @@ export type MatSnackBarVerticalPosition = 'top' | 'bottom';
/**
* Configuration used when opening a snack-bar.
*/
export class MatSnackBarConfig {
export class MatSnackBarConfig<D = any> {
/** The politeness level for the MatAriaLiveAnnouncer announcement. */
politeness?: AriaLivePoliteness = 'assertive';

Expand All @@ -41,13 +42,13 @@ export class MatSnackBarConfig {
* Extra CSS classes to be added to the snack bar container.
* @deprecated Use `panelClass` instead.
*/
extraClasses?: string | string[];
extraClasses?: string | string[];

/** Text layout direction for the snack bar. */
direction?: Direction = 'ltr';

/** Data being injected into the child component. */
data?: any = null;
data?: D | null = null;

/** The horizontal position to place the snack bar. */
horizontalPosition?: MatSnackBarHorizontalPosition = 'center';
Expand Down