>
> Another Service is calling that method:
>
>
import { Injectable } from '@angular/core';
import { CanActivate,
Router,
ActivatedRouteSnapshot,
RouterStateSnapshot } from '@angular/router';
import { AuthService } from './auth.service';
import { LoginResponseModel } from './Login/loginResponseModel';
@Injectable()
export class AuthGuard implements CanActivate{
constructor(private _authService: AuthService, private _router: Router)
{}
canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot
){
if(this._authService.subscribeIsUserLoggedIn()){
return true;
}else{
this._router.navigate(['/login']);
return false;
}
}
}
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.