Skip to content

Commit

Permalink
chore(dialog): add generic param for config data
Browse files Browse the repository at this point in the history
Adds a generic parameter to the `MatDialogConfig` that indicates the type of its `data`.

Fixes angular#4398.
  • Loading branch information
crisbeto committed Sep 30, 2017
1 parent 3c6f7a2 commit a1c6b56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/lib/dialog/dialog-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface DialogPosition {
/**
* Configuration for opening a modal dialog with the MatDialog service.
*/
export class MatDialogConfig {
export class MatDialogConfig<D = any> {

/**
* Where the attached component should live in Angular's *logical* component tree.
Expand Down Expand Up @@ -61,7 +61,7 @@ export class MatDialogConfig {
position?: DialogPosition;

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

/** Layout direction for the dialog's content. */
direction?: Direction = 'ltr';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/dialog/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ export class MatDialog {
* @param config Extra configuration options.
* @returns Reference to the newly-opened dialog.
*/
open<T>(componentOrTemplateRef: ComponentType<T> | TemplateRef<T>,
config?: MatDialogConfig): MatDialogRef<T> {
open<T, D = any>(componentOrTemplateRef: ComponentType<T> | TemplateRef<T>,
config?: MatDialogConfig<D>): MatDialogRef<T> {

const inProgressDialog = this.openDialogs.find(dialog => dialog._isAnimating());

Expand Down

0 comments on commit a1c6b56

Please sign in to comment.