Nested module routing not working in angular

337 views
Skip to first unread message

Emad Khan

unread,
Dec 14, 2019, 5:00:39 AM12/14/19
to Angular and AngularJS discussion

I am creating an angular app from a fuse-angular-template, now I have created a modules folder in which I have placed all my components, inside the routine-work folder I have created a routine.module.ts which can be seen in the picture attached, in this module I have declared all the components placed in routine-work folder and to make them work I have created a separate routine.module.ts file and created 1 sample route in order to check if my app is working or not. Then I referenced the routine-module file in app.module.ts, now whenever i run my application through ng-serve, it only displays the summary component and none other, like when i enter Routine/ManageDebtors url in browser it does not load that component, instead it shows only summary component.


routinemodule.png

appmodule.png



Arnaud Deman

unread,
Dec 15, 2019, 9:44:09 AM12/15/19
to Angular and AngularJS discussion

Hi Emad,

I think the summary component is displayed because the Routine / ManageDebtors route does not match your route definition, so the default route is used.
You can try these fixes:
In app.module.ts, replace the path above loadChildren with the URI you want to reach: Routine / ManageDebtors and in routine.module.ts, use an empty path: path: '' ,

Since you have set enableTracing true, you should see the router's debug information in the console.

Regards,
Arnaud.
Reply all
Reply to author
Forward
0 new messages