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

Include the injector name in error: Trying to get the Angular injector before bootstrapping the corresponding Angular module #37579

Open
marianazangrossi opened this issue Jun 14, 2020 · 3 comments

Comments

@marianazangrossi
Copy link

@marianazangrossi marianazangrossi commented Jun 14, 2020

🚀 feature request

Relevant Package

This feature request is for @angular/upgrade

Description

In the project I'm working we are migrating AngularJS to Angular 2+ and we face this error often: Trying to get the Angular injector before bootstrapping the corresponding Angular module. It would be very helpful to include the injector name in the error message, it would save a lot of time instead of search each injector until finding the one which is throwing this error.

Describe the solution you'd like

Trying to get the Angular injector before bootstrapping the corresponding 'Angular module. Injector name: SomeAngularService.

@gkalpak
Copy link
Member

@gkalpak gkalpak commented Jun 15, 2020

Is this failing for a downgraded injectable (or are there more usecases where this can break)?

From a quick look, I think this error will only be thrown when trying to inject a downgraded injectable (without having loaded the corresponding module).

If that's the case, we could add a try/catch block and throw a more descriptive error here.

@marianazangrossi
Copy link
Author

@marianazangrossi marianazangrossi commented Jun 25, 2020

I'm not sure @gkalpak, this use to happen when trying to use an upgraded service in an AngularJS directive/component/controller/service. I think that is what are you meaning, right?

@gkalpak
Copy link
Member

@gkalpak gkalpak commented Jun 25, 2020

Oh, that's different. Can you show an example of the failure?
(You can use this StackBlitz project as a starting point if it helps.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.