具有百分比(%2)且不呈现页面的查询参数的角

问题描述 投票:0回答:1

我不知所措,如何使用查询参数解决此问题并不会呈现角度视图。我已经从后端对字符串进行了编码。

这不起作用:http://localhost:2333/change-password?token=cfdj8ka%2bqsu

这有效:http://localhost:2333/change-password?token=cfdj8kahttp://localhost:2333/change-password?token=cfdj8kabqsu

我相信%2是(/)的编码值。如何获得我的角度路线以正确解码。我正在使用Angular 5。

感谢

angular angular-ui-router
1个回答
0
投票

可能您正在使用this.router.navigate([url])而不是该用途

this.router.navigateByUrl(url);

在构造函数中

constructor(private _route: ActivatedRoute,) { 
   let token= this._route.snapshot.queryParamMap.get('token');
}
© www.soinside.com 2019 - 2024. All rights reserved.