I have a component named reset-password-modal. I need to use this component when a user gets a link to reset a password. In the link, there are details regarding the user, username, mail, and a token. I need to display the username, email on UI, from the given link. The format of the link is like this: http://localhost:4200/#/resetPassword?email=someone@something.com&userName=YourName&token=iAMyourTOKEN.
I referred to many of the StackOverflow answers regarding how to use Angular's ActivatedRoute. But was not able to get the desired output.
Some of the ways which I tried.
import { ActivatedRoute } from '@angular/router'
constructor(private activateRoute: ActivatedRoute){}
ngOnInit(){
const email = String(this.activateRoute.snapshot.paramMap.get('email'))
console.log(email);
}
Every time I am receiving a null value in return.
Another way which I tried was using queryParamMap but was not able to retrieve the needed information. I have also tried subscription to the params but didn't help. Any help is appreciated. Thank you.