【发布时间】:2016-10-10 13:33:57
【问题描述】:
我需要在语言上做一个可选的前缀。 所以你可以去
random-domain.com/
将选择默认语言(zh)
如果你选择了语言
random-domain.com/ru
将选择语言 - ru
这应该适用于嵌套路由
random-domain.com/some-rand-entity 和 random-domain.com/ru/some-rand-entity em>
我的无效解决方案 - 示例
const app_common: Routes = [ ...];
export const app_routes: Routes = [
{
path: '',
component: HomeComponent,
resolve: {
settings: SettingsStore
},
pathMatch: 'full'
}
];
export const lang_routes: Routes = [
{
path: ':lang',
component: HomeComponent,
resolve: {
languages: LanguagesStore
},
children: app_common,
pathMatch: 'full'
}
];
export const routes: Routes = [
...app_routes,
...app_common,
...lang_routes,
...checkoutRoutes
];
【问题讨论】:
标签: javascript angular angular2-routing