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

MdDialog cannot display AngularJS content upgraded via UpgradeModule #3617

Closed
MikeMatusz opened this issue Mar 15, 2017 · 3 comments
Closed

Comments

@MikeMatusz
Copy link

Bug:

Content upgraded via the UpgradeModule cannot be displayed in a modal.

What is the expected behavior?

Dialog displays with the upgraded component.

What is the current behavior?

Error: No provider for $scope!
at NoProviderError.BaseError [as constructor] (VM444 core.umd.js:1244)
at NoProviderError.AbstractProviderError [as constructor] (VM444 core.umd.js:1365)
at new NoProviderError (VM444 core.umd.js:1405)
at ReflectiveInjector_.throwOrNull (VM444 core.umd.js:2937)
at ReflectiveInjector
.getByKeyDefault (VM444 core.umd.js:2976)
at ReflectiveInjector
.getByKey (VM444 core.umd.js:2908)
at ReflectiveInjector
.get (VM444 core.umd.js:2777)
at PlunkerAppModuleInjector.NgModuleInjector.get (VM444 core.umd.js:8491)
at View_DialogExample1.AppView.injectorGet (VM444 core.umd.js:11935)
at View_DialogExample1.DebugAppView.injectorGet (VM444 core.umd.js:12315)

What are the steps to reproduce?

https://plnkr.co/edit/fbEavuu5Va78MgdTwLhy?p=preview
Clicking "Show Upgraded Component" works, but showing the same component in a dialog via the "Show Dialog" button does not.

What is the use-case or motivation for changing an existing behavior?

We have rewritten our app in Angular, but still rely on a few AngularJS components. They work everywhere else in our app except for inside of a modal.

Which versions of Angular, Material, OS, browsers are affected?

Tested with both Angular 2.4.7 and 4.0 beta 5. Material 2.0 beta 2. Chrome, IE, Firefox on Windows 8.

@MikeMatusz
Copy link
Author

So of course, after fighting with this for a day and a half, I figure it out a solution 30 minutes after posting an issue. It's using an undocumented config option (well, the option is listed on the docs page: https://material.angular.io/components/component/dialog, it just has no description) to pass the viewContainerRef of the component that's showing the dialog. If anyone from the material team would like to comment on whether that is the correct use of that option, or to update the documentation with more info, that would be great, but I think this issue can be closed.

Here is the updated plunk:
https://plnkr.co/edit/WrdhYrNQ4UAL6dmQYiGi?p=preview

@jelbourn
Copy link
Member

Thanks for the report- I've filed #3651 to track the missing docs.

@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 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants