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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route not working in v9, but works fine in v9, if Ivy disabled. #36223

Closed
DraganMaricDeveloper opened this issue Mar 24, 2020 · 4 comments
Closed

Comments

@DraganMaricDeveloper
Copy link

@DraganMaricDeveloper DraganMaricDeveloper commented Mar 24, 2020

馃悶 bug report

Affected Package
"@angular/core": "~9.0.7",

Is this a regression?

Yes, the previous version in which this bug was not present was: 8.2.5

Description

I am having problem with loading component, when app starts. It is not lazy loaded(as you can see it from app route file), updated from v8 to v9 went ok. It works great at v8, but after updating to v9 and enabling ivy to true, routing is not working. If ivy is set to false, it works again, even in v9! That's weird.

Basically, when user enters ''.com, it redirects to /questions or user enters /questions.com, it is working fine when ivy is set false.

Issue is already posted on stackoverflow:

https://stackoverflow.com/questions/60798432/after-updating-angular-from-v8-to-v9-and-enabling-ivy-to-true-component-is-not

馃實 Your Environment

Angular Version:


Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.7
@angular-devkit/build-angular     0.900.7
@angular-devkit/build-optimizer   0.900.7
@angular-devkit/build-webpack     0.900.7
@angular-devkit/core              9.0.7
@angular-devkit/schematics        9.0.7
@ngtools/webpack                  9.0.7
@nguniversal/builders             9.0.2
@nguniversal/common               9.0.2
@nguniversal/express-engine       9.0.2
@schematics/angular               9.0.7
@schematics/update                0.900.7
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.41.2
@alxhub

This comment has been minimized.

Copy link
Contributor

@alxhub alxhub commented Mar 24, 2020

Hi @DraganMaricDeveloper,

Sorry to hear you're having trouble with one of your routes! Unfortunately without an example reproduction that we can run and debug, we won't be able to get very far in diagnosing this issue. The files you post on stackoverflow don't really allow us to reproduce this issue - so if you could provide a Github repo or Stackblitz with instructions on how to observe the problem, we can definitely get to the bottom of it for you.

@DraganMaricDeveloper

This comment has been minimized.

Copy link
Author

@DraganMaricDeveloper DraganMaricDeveloper commented Mar 25, 2020

Hi Alex,
Thank you for your quick response. Yea, you are right. I didn't provide repro, this is my first issue commit :) Well, it is quite medium size project and it is difficult just to add a piece and test it. What about giving a private access to repository? Will that work for you? And great work devs, really love Angular!

@DraganMaricDeveloper

This comment has been minimized.

Copy link
Author

@DraganMaricDeveloper DraganMaricDeveloper commented Mar 25, 2020

I forgot to tell that all other components (lazy loaded) are working great. Just questions module is provided in app module, when app starts.

@DraganMaricDeveloper

This comment has been minimized.

Copy link
Author

@DraganMaricDeveloper DraganMaricDeveloper commented Mar 26, 2020

I found the problem. I went through questions component step by step commenting every single line. The problem was when providing AuthService in one of the questions child component! It seems that AuthService provided in constructor was not "there yet" aka not initialised.

So the solution was in AuthService instead of just using decorator @Injectable, I am now providing this service in root of the app, as it should be:

@Injectable({
  providedIn: 'root'
})

Thank you Angular team, keep doing great work!

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
4 participants
You can鈥檛 perform that action at this time.