我正在处理角度6。.我想使用户从外部链接重定向到特定路由..但是,当用户单击链接时,他被重定向到“索引”
这是我的路线
RouterModule.forRoot([
{ path: "Startup", component: StartupComponent },
{ path: "Login", component: SigninComponent },
{ path: "FirstPage", component: FirstPageComponent },
{ path: "Index", component: IndexComponent, canActivate: [ComponentGuardService] },
{ path: "Requests", component: IndexComponent, canActivate: [ComponentGuardService] },
{ path: "RequestsDetails/:id", component: RequestsDetailsComponent, canActivate: [ComponentGuardService] },
{ path: "RequestsStatistics", component: RequestsStatisticsComponent, canActivate: [AdminGuardService,ComponentGuardService] },
{ path: "", redirectTo: "Index", pathMatch: "full" },
{ path: "**", redirectTo: "Login", pathMatch: "full" }
], { useHash: true })
和ComponentGuardService
canActivate(): boolean {
let me = Shared.Me;
if (me == null || me.Id == "") {
this.navigator.navigate(["/Startup"]);
return false;
}
else
return true;
}
我想让用户重定向到请求路由
谢谢:)