I want to add some route guard based on Firebase auth displayName
property.
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
if ( firebase.auth().currentUser.displayName === 'student' ) {
return true;
} else {
return false;
}
}
but this function is not working .
How to do this correctly?