import { Injectable } from '@angular/core' ; import { CanActivate , RouterStateSnapshot } from '@angular/router' ; import { AuthService } from './auth.service' ; @ Injectable ( ) export class AuthGuard implements CanActivate { constructor ( private authService ) { } canActivate ( _ , state ) { return this . authService . authenticate ( state . url ) ; } }