I want to navigate directly in here component ResetPassIdComponent
whene I use canActivate(); Now, when I click for this component ResetPassIdComponent , my aplication navigate in first in /outsidelogin/login
and in second in resetPasswordRequest/:id
export class AuthGuard implements CanActivate {
constructor(private router: Router, private auth: LoginService) { }
canActivate(): boolean {
if (this.auth.isAuthenticated()) {
return true;
}
this.router.navigate(['/outsidelogin/login']);
return false;
}
}
So in this canActivate() I have 2 conditions, first if I'm login and second if I'm not login navigate in this.router.navigate(['/outsidelogin/login']);
My routing.ts
const routes: Routes = [
{
path: 'home',
component: HomeComponent,
canActivate: [AuthGuard],
children: [
{
path: 'fp', component: FirstPageComponent
}
]
},
{
path: 'outsidelogin',
component: outsideloginComponent,
children: [
{ path: 'login', component: LoginFirstComponent },
{ path: 'register', component: RegisterComponent },
]
},
{ path: '', redirectTo: '/home/fp', pathMatch: 'full' },
{ path: 'resetPasswordRequest/:id', component: ResetPassIdComponent }
];
Please, Can you share with me any idea, how to solve my problem?