For some reason I have to add the string '../home/home.module#HomeModule' to loadChildren, but how come a function that returns the same string does not work? I want to be able to concat the string based on some variables such as if it is going to be ahead of time compilation because then I can't do ../, I have to do ./ as the root path.
Any workaround for this?
function loadHome() {
return '../home/home.module#HomeModule';
}
const mainRoutes: Routes = [
{
path: '',
component: MainComponent,
children: [
{ path: '', loadChildren: loadHome()}
]
},
{ path: '**', redirectTo: '/' }
];
I am getting the error: EXCEPTION: Uncaught (in promise): Error: Cannot find module '../home/home.module'