我想在网址上定义网站语言。例如"mysite.com/en/blabla“。但我为每个客户提供了不同的语言。如果客户不支持英语,angular应该返回404,我尝试这样做:
const languages:Routes = Object.getOwnPropertyNames(environment.trader.langList).map(path => {
return {
path, component: OutComponent,
children: [
{ path: 'place-bet', loadChildren: '../../desktop/placebet/placebet.module#PlacebetModule' },
{ path: 'games', loadChildren: '../../desktop/games/games.module#GamesModule' },
{ path: 'dashboard', loadChildren: '../../desktop/dashboard/dashboard.module#DashboardModule' }]
};
})
debugger;
const OutRoutes: Routes = [
...languages
];
export const OutRouter = RouterModule.forChild(OutRoutes);我从环境中获取语言,并为每种语言生成路由。这适用于运行时,但当我编译时,它给出一个错误:"ERROR in Cannot read property 'loadChildren‘of undefined“。它不能在编译时编译映射的路由。我怎么解决它呢?
https://stackoverflow.com/questions/51260069
复制相似问题