In app.module.ts I use APP_INITIALIZER to call my initialiser service (ApplicationInitialiserService). This loads data from an api and creates routes dynamically. All these routes target a child component.
When I click the router links to navigate this initialises the targeted component and everything loads fine.
But when I refresh the page it does not load up this child component.
Maybe I need to detect a page refresh and load in the child component? Any suggestions greatly appreciated
Test code - if you go to https://ivw5j6.csb.app/ and click the routerLink to /test it loads and shows "page works" But if you refresh https://ivw5j6.csb.app/test the page component does not load.
CodePudding user response:
You need to add this.router.initialNavigation();
in your service after adding routes