【发布时间】:2020-10-28 15:23:50
【问题描述】:
我想在成功登录后重定向到另一个 url。此外,当它重定向时,我还想隐藏查询参数。 这是我的 LoggedinGuard
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
if (this.authService.getUser()) {
return true;
}
this.router.navigate(['login'], { queryParams: { redirectUrl: state.url }});
return false;
}
登录成功后浏览器中的链接为http://localhost:4200/login?redirectUrl=%2Fgetup
但我需要显示为 http://localhost:4200/login
我该怎么做?
【问题讨论】:
标签: angular typescript