import { Injectable } from '@angular/core' ; import { CanActivate , ActivatedRouteSnapshot , RouterStateSnapshot } from '@angular/router' ; import { Observable } from 'rxjs/Observable' ; import { UserService } from './user.service' ; @ Injectable ( ) export class AuthGuardGuard implements CanActivate { constructor ( private user ) { } canActivate ( next , state ) { return this . user . getUserLoggedIn ( ) ; } }