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

Closed
marianadasilvadev opened this issue Jun 14, 2020 · 4 comments
Assignees
Milestone

Comments

@marianadasilvadev
Copy link

🚀 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 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.

@marianadasilvadev
Copy link
Author

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 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.)

@sonukapoor sonukapoor self-assigned this Sep 1, 2020
sonukapoor added a commit to sonukapoor/angular that referenced this issue Sep 2, 2020
This commit improves the error thrown by the downgrade module with a more
descriptive message on why the downgrade is failing.

Closes angular#37579
sonukapoor added a commit to sonukapoor/angular that referenced this issue Sep 2, 2020
This commit improves the error thrown by the downgrade module with a more
descriptive message on why the downgrade is failing.

Closes angular#37579
sonukapoor added a commit to sonukapoor/angular that referenced this issue Sep 2, 2020
This commit improves the error thrown by the downgrade module with a more
descriptive message on why the downgrade is failing.

Closes angular#37579
sonukapoor added a commit to sonukapoor/angular that referenced this issue Sep 2, 2020
This commit improves the error thrown by the downgrade module with a more
descriptive message on why the downgrade is failing.

Closes angular#37579
AndrewKushnir pushed a commit that referenced this issue Sep 10, 2020
This commit improves the error thrown by the downgrade module with a more
descriptive message on why the downgrade is failing.

Closes #37579

PR Close #38671
@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 Oct 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants