Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Impossible to load nested routes in Angular 10+

Like I said in the title I have a problem with a nested routes in Angular.

When I hit the url /rules/disciplines I want to load RulesComponent and DisciplinesComponent but I can only load the rules one.

I simply put a console.log("Rules/DisciplinesComponent loaded") in both component ngOnInit method and only the RulesComponent works.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

This is my rules-routing.module.ts :

enter image description here

And this is my discipline-routing.module.ts

enter image description here

You can found the full code on my github : https://github.com/AntoineRenoux/BloodyNights-SPA/tree/dev/src/app/core/components/rules

Be carefull to select the "dev" branch.

Thx for reading

>Solution :

Based on your source code you need to add a <router-outlet> to RulesComponent template else you cannot load children.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading