I see some example code here:
The specific code is:
canActivate(next: ActivatedRouteSnapshot, { url }: RouterStateSnapshot): boolean
{
if (!this.authService.isLoggedIn) {
this.router.navigateByUrl('/auth', { state: { redirect: url } });
}
return this.authService.isLoggedIn;
}
What exactly will happen here if this.authService.isLoggedIn = false?
navigateByUrl is then called in this function, before this.authService.isLoggedIn is returned, how will this behave? Will the function return "false" as value "immediately"? Or will CanActivate be "aborted" somehow by the navigateByUrl function?
A bit tricky to explain, but it seems strange to return a value from a CanActivate function that is not relevant anymore... because you have navigated away from the page that was requested...