web - 从其他应用程序重定向到 Angular 6 Route
问题描述
我正在研究 Angular 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;
}
我想让用户重定向到请求路由
谢谢你 :)
解决方案
推荐阅读
- java - 如何为移动方法创建二维房间出口数组(-1 = 无出口)?
- python - 这个命令有什么作用?导入 re.sub('".*?"', ' ', text)
- json - 如何使用`jq`处理单行json文件
- docker - 如何访问在 nginx-proxy 后面的 theia docker 容器上运行的应用程序?
- ios - 如何根据密码将输入的文本与字符串进行比较以触发新的转场
- react-native - 使用连接时出错(react-redux 库的功能)
- javascript - 在 Web 项目中隐藏我的 firebase js 脚本的位置
- c# - 在目录中生成文件名列表,修改文件名但仍然可以访问完整路径 winforms
- python - 无法使用 pymongo 删除 mongodb 文档
- java - 如何使用 QuerydslPredicate 按子对象属性进行过滤?