-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
fix(dialog): provide default value for MD_DIALOG_DATA token #4120
Conversation
Adds a default value for the `MD_DIALOG_DATA` injection token, instead of throwing an error when it's not defined. Fixes angular#4086.
src/lib/dialog/dialog-config.ts
Outdated
@@ -40,7 +40,7 @@ export class MdDialogConfig { | |||
position?: DialogPosition; | |||
|
|||
/** Data being injected into the child component. */ | |||
data?: any; | |||
data?: any = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about null
instead of {}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
oddly I am gettig this error in a popup window... i.e. window.open... I know the values can't be passed there so I will try @optional() |
that was scary lol... @optional did the trick... I feel like this should just be obvious without dragging something in. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds a default value for the
MD_DIALOG_DATA
injection token, instead of throwing an error when it's not defined.Fixes #4086.