I'am trying to setup routes in Angular's app.
app-routing.module.ts
import {PreloadAllModules, RouterModule, Routes} from "@angular/router";
export const APP_ROUTES: Routes = [
{
path: "",
redirectTo: "momentum",
pathMatch: "full"
},
{
path: "momentum",
loadChildren(): any {
return import('./pages/momentum/momentum.module').then(m => m.MomentumModule);
}
}
];
export const routing = RouterModule.forRoot(APP_ROUTES, {
preloadingStrategy: PreloadAllModules
});
momentum-routing.module.ts
import {RouterModule, Routes} from "@angular/router";
import {MomentumComponent} from "./momentum.component";
const ROUTES: Routes = [
{
path: "",
component: MomentumComponent
}
];
export const taskRouting = RouterModule.forChild(ROUTES);
I was thinking it is easy to configure, but on locally works everything. On "production" I still getting error:
It looks like module doesn't see this routing, but I have it in "imports" in momentum.module.ts
It's angular 6, very old app.
Any idea where may I find issue?
Try this
export const APP_ROUTES: Routes = [
{
path: "",
redirectTo: "momentum",
pathMatch: "full"
},
{
path: "momentum",
loadChildren: () => import('./pages/momentum/momentum.module').then(m => m.MomentumModule)
}
];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.