从其他应用程序重定向到Angular 6路由

时间:2018-07-24 08:38:26

标签: web angular-ui-router angular6

我正在处理角度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;
  }

我想让用户重定向到请求路由

谢谢:)

0 个答案:

没有答案