Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/465.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.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
Javascript 无法从角度中的路由中找到参数_Javascript_Angular_Typescript - Fatal编程技术网

Javascript 无法从角度中的路由中找到参数

Javascript 无法从角度中的路由中找到参数,javascript,angular,typescript,Javascript,Angular,Typescript,我有一封信,塞纳里奥: 当使用“在网站注册”时,我会向该电子邮件发送一封电子邮件。在其中,您有一个链接,必须单击该链接以验证注册 该路线具有以下信息: http://localhost:4200/auth/verify-checking?email={0}&code={1} 我创建了这条路线: { path: 'verify-checking', component: CheckingVerifedComponent }, 但我有两个问题: A:找不到参数: 我使用此代码但不起作

我有一封信,塞纳里奥:

当使用“在网站注册”时,我会向该电子邮件发送一封电子邮件。在其中,您有一个链接,必须单击该链接以验证注册

该路线具有以下信息:

http://localhost:4200/auth/verify-checking?email={0}&code={1}
我创建了这条路线:

  { path: 'verify-checking', component: CheckingVerifedComponent },
但我有两个问题:

A:找不到参数:

我使用此代码但不起作用:

this.route.params.subscribe(params => {
  this.sendModel.email = params['email'];
  this.sendModel.code = params['code'];
});
B:它告诉我这个错误:

错误:无法匹配任何路由。URL段:“验证/验证检查%3Femail%3Dkianoushvv123456@gmail.com&代码%3DCfDJ8PQkunuAtiZOulV9qQ%252F3astuT%252Fa2VVXDAhxbE%252Fpg%252FFMCPXCFXPR3GUNRZS443WCXRXXWEFG3PHVQMDBJL5GZX8DWGI0UUZTVDWDWDWDWDW%25206U2HSNBTQ1X7YHH%2520%2520ym3%252FP3RLIN4VGXJEMBMQPKYE7XSNJYCTNVHY141NK%252FZKEPUVZO5QH%2520jNyRXA%253D%253D'

< >强>我如何解决这个问题?<> <强>

< p>你可以考虑:

路线

参数提取

this.sendModel.email = this.route.snapshot.paramMap.get('email');
this.sendModel.code = this.route.snapshot.paramMap.get('code');
你可以考虑这个问题:

路线

参数提取

this.sendModel.email = this.route.snapshot.paramMap.get('email');
this.sendModel.code = this.route.snapshot.paramMap.get('code');
queryParam用于?email={0}&code={1}

this.route.queryParams.subscribe(params => {
  this.sendModel.email = params['email'];
  this.sendModel.code = params['code'];
});
queryParam用于?email={0}&code={1}

this.route.queryParams.subscribe(params => {
  this.sendModel.email = params['email'];
  this.sendModel.code = params['code'];
});

您应该添加pathMatch:'full',比如{path:'verify checking',component:checkingverifiedcomponent,pathMatch:'full'}@pbachman仍然显示该错误您应该添加pathMatch:'full',比如{path:'verify checking',component:checkingverifiedcomponent,pathMatch:'full'}@pbachman仍然显示该错误