问题描述
我在 Angular 中使用 MsalGuard 来保护我的网页,而 msalService 使用重定向登录。
这是我的 app-routing.module.ts:
const routes: Routes = [
{path: '',canActivate: [MsalGuard],children: [
{ path: '',redirectTo: 'home',pathMatch: 'full' },{ path: 'home',component: HomeComponent},{ path: 'test/:id',component: ProjectDetailsComponent},{ path: '**',redirectTo: 'home' },]}
];
const isIframe = window !== window.parent && !window.opener;
@NgModule({
imports: [RouterModule.forRoot(routes,{ useHash: true,relativeLinkResolution: 'legacy',initialNavigation: !isIframe ? 'enabled' : 'disabled' })],exports: [RouterModule]
})
当我想打开 http://localhost:4200/#/test/10 时,它成功登录,但我被重定向到 http://localhost:4200/#/home 。 如果我删除:
{ path: '**',redirectTo: 'home' }
它正确地将我重定向到我想要的网址。因为我仍然想使用这个路由,所以我需要一个不同的解决方案。有没有人知道如何解决这个问题?谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)