Skip to content

Opening an MdDialog with a TemplateRef that uses md-dialog-close throws "no provider for MdDialogRef" #5412

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

Closed
alex321 opened this issue Jun 29, 2017 · 4 comments · Fixed by #9379
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@alex321
Copy link

alex321 commented Jun 29, 2017

Proposal:

Provide MdDialogRef even when we pass a TemplateRef.

What is the current behaviour?

With the current setup if we pass a TemplateRef to MdDialog, there is no way to use md-dialog-close directive as it throws no provider for MdDialogRef as it requires it.

What is the expected behaviour?

It would be great if it works with a TemplateRef but if that's not possible, then could you please add a brief warning to the docs?

What are the steps to reproduce?

I can provide a plunkr if needed.

@crisbeto
Copy link
Member

This is a known issue. It's because we can't set a custom injector on a template ref (since it's already instantiated). I've discussed a potential solution with @jelbourn, but haven't gotten around to implementing it yet.

@crisbeto crisbeto self-assigned this Jun 29, 2017
@christophechevalier
Copy link

Hi,

Any news on that?

Thanks :)

@pitops
Copy link

pitops commented Oct 28, 2017

Hello any news on this?

@crisbeto crisbeto added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Nov 28, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 13, 2018
…ialogs

Previously the `matDialogClose`, `matDialogTitle` etc. directives would only work correctly inside component dialogs, because using DI to get the dialog ref doesn't work inside template dialogs. These changes add a fallback that finds the dialog ref based on the id of the closest dialog container.

Fixes angular#5412.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 16, 2018
…ialogs

Previously the `matDialogClose`, `matDialogTitle` etc. directives would only work correctly inside component dialogs, because using DI to get the dialog ref doesn't work inside template dialogs. These changes add a fallback that finds the dialog ref based on the id of the closest dialog container.

Fixes angular#5412.
jelbourn pushed a commit that referenced this issue Jan 21, 2018
…ialogs

Previously the `matDialogClose`, `matDialogTitle` etc. directives would only work correctly inside component dialogs, because using DI to get the dialog ref doesn't work inside template dialogs. These changes add a fallback that finds the dialog ref based on the id of the closest dialog container.

Fixes #5412.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 23, 2018
…ialogs

Previously the `matDialogClose`, `matDialogTitle` etc. directives would only work correctly inside component dialogs, because using DI to get the dialog ref doesn't work inside template dialogs. These changes add a fallback that finds the dialog ref based on the id of the closest dialog container.

Fixes angular#5412.
jelbourn pushed a commit that referenced this issue Jan 24, 2018
…ialogs (#9379)

Previously the `matDialogClose`, `matDialogTitle` etc. directives would only work correctly inside component dialogs, because using DI to get the dialog ref doesn't work inside template dialogs. These changes add a fallback that finds the dialog ref based on the id of the closest dialog container.

Fixes #5412.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants