Skip to content
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

chore(dialog): add generic param for config data #7447

Merged
merged 1 commit into from
Oct 12, 2017
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
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> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this require TS 2.3 or 2.4?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're at ~2.4.2.


/**
* Where the attached component should live in Angular's *logical* component tree.
Expand Down Expand Up @@ -73,7 +73,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