【发布时间】:2021-09-28 12:13:28
【问题描述】:
在我的应用程序中,我使用延迟加载。这是app.module.ts
const appRoutes: Routes = [
{
path: "your-app",
canActivate: [AuthGuard],
loadChildren: "app/components/your-app/your-app.module#YourAppModule"
},
{
path: "my-app",
canActivate: [AuthGuard],
loadChildren: "app/components/my-app/my-app.module#MyAppModule"
},
{
path: "**",
redirectTo: "/"
}
];
和我的子模块
export const routes: Routes = [
{
path: "",
component: MyAppComponent
}
];
当我点击http://localhost:4200/#/my-app?myParam=test
它将我重定向到http://localhost:4200/#/
有什么遗漏吗?
【问题讨论】:
-
只是为了确保 - 您确定 AuthGuard 没有阻止您访问路径吗?您是否尝试禁用此防护只是为了检查它是否不是问题的原因?
-
@PawelWoroniecki 谢谢,是的,我的警卫挡住了它
-
很高兴看到您的问题现已解决
标签: angular routes angular-routing