Created
June 10, 2018 05:35
-
-
Save krishnaanaril/4d1065e8bbcec56f102cf8965060d593 to your computer and use it in GitHub Desktop.
Example for auth-guard in Angular 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
canActivate() { | |
if ( this.authService.isLoggedIn() ) { | |
return true; | |
} | |
this.router.navigate(['/']); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment