Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.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 角域中routerlink参数的加密解密方法_Angular_Encryption - Fatal编程技术网

Angular 角域中routerlink参数的加密解密方法

Angular 角域中routerlink参数的加密解密方法,angular,encryption,Angular,Encryption,我需要正确的方法来加密和解密查询字符串参数,如gmail.com 如何获得这些查询参数 这条路是什么 {path:'myPrograms/:sosid/:xy',component:MyProgramesComponent} 这是路由器链路吗 将其添加到构造函数中: private activatedroute:activatedroute 您可以通过以下方式在onInit功能上访问params: const sosid = this.activatedroute.snapshot.param

我需要正确的方法来加密和解密查询字符串参数,如gmail.com

如何获得这些查询参数

这条路是什么
{path:'myPrograms/:sosid/:xy',component:MyProgramesComponent}

这是路由器链路吗


将其添加到构造函数中:

private activatedroute:activatedroute

您可以通过以下方式在
onInit
功能上访问
params

 const sosid = this.activatedroute.snapshot.params['sosid'];
 const xy = this.activatedroute.snapshot.params['xy'];
注意:您的url应该类似于localhost:4200/myPrograms/123/32

然后您的
sosid
将具有值
123
xy
将具有值
32

加密和解密的方式由您决定。有很多方法可以做到这一点。这取决于你。例如,您可以决定在编码时将每个ASCII键移一位,然后在解码时将它们移回原处

例如,如果您确定该移位,并且url为
../myPrograms/452/56
,则实际数据将为:

sosid : 341
xy : 45

这只是一种方法,即使很容易,也能实现你想要的。所以我不认为So真的能帮助加密/解密。

而且你在帮助用户方面做得很好!
sosid : 341
xy : 45