import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router'; import { Injectable } from '@angular/core'; import { AuthService } from '@core/services/auth.service'; @Injectable({ providedIn: 'root' }) export class AuthGuard implements CanActivate { constructor(private _authservice: AuthService) {} canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { return this._authservice.isLoggedIn(); } }