Permalink
Switch branches/tags
Nothing to show
Find file Copy path
955cd92 Jan 3, 2018
1 contributor

Users who have contributed to this file

20 lines (16 sloc) 465 Bytes
// auth.guard.ts
import { Injectable } from '@angular/core';
import { Router, CanActivate } from '@angular/router';
import { UserService } from './shared/services/user.service';
@Injectable()
export class AuthGuard implements CanActivate {
constructor(private user: UserService,private router: Router) {}
canActivate() {
if(!this.user.isLoggedIn())
{
this.router.navigate(['/account/login']);
return false;
}
return true;
}
}