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

Why you use RouterModule.forRoot(...) in all modules? #185

Closed
kolkov opened this issue Aug 8, 2017 · 1 comment
Closed

Why you use RouterModule.forRoot(...) in all modules? #185

kolkov opened this issue Aug 8, 2017 · 1 comment

Comments

@kolkov
Copy link

kolkov commented Aug 8, 2017

Hi!
For what reason do you use RouterModule.forRoot(...) in all modules, and not just in the main?

image

@dancancro
Copy link
Owner

That practice came from jhipster.

From the Angular docs it looks like the only difference between them is that forRoot includes the Router service. You're right that it seems we should use .forChild. It's not that clear why though

Only call RouterModule.forRoot in the root AppRoutingModule (or the AppModule if that's where you register top level application routes). In any other module, you must call the RouterModule.forChild method to register additional routes.

I asked on JHipster's Gitter. Maybe someone else knows.

dancancro added a commit that referenced this issue Aug 11, 2017
- Adds Adrian Carriger's Recipe Finder feature
- AoT production build
- Co-locate tests with tested code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants