I am working on an Angular application that involves navigation using routerlinks.
My goal is to navigate to a specific user page by ID if the page is already open and meets certain conditions.
In my .component.ts file, I have the following code snippet:
if(userID == 0){
this.router.navigate(['./user/' + userID]);
}
else{
this.router.navigate(['./details']);
}
The above logic is implemented to check for a user with a particular ID. If the condition is met in the if statement while already being on a user page, then it should navigate to that specific user page with the given ID.
If anyone can provide assistance with this scenario, please feel free to help out.