Javascript 角度:动态设置基本URL
我的Angular项目要求在同一个域上拥有多个网站实例,这些实例具有不同的基本URL,并共享相同的路由名称Javascript 角度:动态设置基本URL,javascript,angular,typescript,angular-routing,Javascript,Angular,Typescript,Angular Routing,我的Angular项目要求在同一个域上拥有多个网站实例,这些实例具有不同的基本URL,并共享相同的路由名称 http://example.com/login/account <base href="/login/" /> http://example.com/create/account <base href="/create/" /> 下面是我的Shell路径,用于登录和创建 export const routes = {
http://example.com/login/account <base href="/login/" />
http://example.com/create/account <base href="/create/" />
下面是我的Shell路径,用于登录
和创建
export const routes = {
'createRoutes': [
{ path: 'account', loadChildren: () => import('@libs/create-client').then(m => m.EnrolCompareModule) },
{ path: '**', component: PageNotFoundComponent }
],
'loginRoutes': [
{ path: 'account', loadChildren: () => import('@libs/login-client').then(m => m.NormalLoginModule) },
{ path: '**', component: PageNotFoundComponent }
]
};
所以在routing module.ts中
const routes = [
{ path: 'login/account', loadChildren: () => import('@asfc/ubc-login-client').then(m => m.NormalLoginModule) },
{ path: 'enrol/account', loadChildren: () => import('@asfc/ubc-enrol-client').then(m => m.MyaEnrolmentModule) },
];
通过以上路径,我的工作将在以下路径中进行
http://example.com/login/login/account
http://example.com/create/create/account
如何解决这个问题?请引导我
http://example.com/login/login/account
http://example.com/create/create/account