Skip to content Skip to sidebar Skip to footer

Can Not Find Params From Route In Angular

i have this senario : when use register in site i send a email to that email . in that have a link and must click on that link for verify registertion . that route have this inform

Solution 1:

http://localhost:4200/auth/verify-checking?email={0}&code={1}

queryParam is used for ?email={0}&code={1}

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

Solution 2:

You may consider this:

Route

 { path: 'verify-checking/:email/:code', component: CheckingVerifedComponent }

Extracting the Parameters

this.sendModel.email = this.route.snapshot.paramMap.get('email');
this.sendModel.code = this.route.snapshot.paramMap.get('code');

Post a Comment for "Can Not Find Params From Route In Angular"