Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 角度返回url为空_Angular - Fatal编程技术网

Angular 角度返回url为空

Angular 角度返回url为空,angular,Angular,在我的应用程序中,如果个人未登录,则使用返回url登录 this.user=this._session.getEmployee(); if(!this.user){ this.router.navigate(['PA/Login'], {queryParams: {returnUrl:this.url}}); } 在ngOnInit中的登录组件中,我正试图用下面的代码访问。 在costructor中,我声明了私有路由:ActivatedRoute this.url=this.ro

在我的应用程序中,如果个人未登录,则使用返回url登录

 this.user=this._session.getEmployee();
 if(!this.user){
    this.router.navigate(['PA/Login'], {queryParams: {returnUrl:this.url}});
 }
ngOnInit
中的登录组件中,我正试图用下面的代码访问。 在costructor中,我声明了
私有路由:ActivatedRoute

this.url=this.route.snapshot.paramMap.get('returnUrl');
这是我的路线配置

const routes: Routes = [
  {path:"",redirectTo:"PA/Login",pathMatch:"full"},
  {path:"PA",redirectTo:"PA/Login",pathMatch:"full"},
  {path:"PA/Home",component:HomeComponent}, 
  {path:"PA/Email/:url",component:EmailComponent}, 
  {path:"PA/Login",component:LoginComponent}, 
  {path:"PA/Login?returnUrl=:returnUrl",component:LoginComponent}, 
];
但它返回null。我在哪里犯错误


感谢您的帮助

您正在尝试从
paramMap
获取查询参数,您应该在以下时间完成:

此外,路由器配置中不需要以下行:


{path:“PA/Login?returnUrl=:returnUrl”,component:LoginComponent},
您正试图从
paramMap
获取查询参数,这时您应该通过:

此外,路由器配置中不需要以下行:


{path:“PA/Login?returnUrl=:returnUrl”,component:LoginComponent},

你能发布你的路由器配置吗?我有疑问你能发布你的路由器配置吗?我有疑问
this.route.snapshot.queryParamMap.get('returnUrl');