export class AuthGuard implements CanActivate {
    constructor(private PassportService: PassportService, private CookieService: CookieService, private router: Router) {
    }
    canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
        console.log("yoyoyo");
        console.log(next);
        console.log(state);
        console.log("Need Login = " + next.data.auth);
        console.log("PassportService isLogin = " + this.PassportService.isLogin);
        console.log("PassportService userData = " + this.PassportService.userData);
        if (next.data.auth === true) {
            if (this.PassportService.isLogin === true) {
                return true;
            }
            if (this.PassportService.isLogin === false) {
                //this.PassportService.getUserData()
                this.http.get("/api/user/data")
                    .subscribe(r => {
                        if ( r.success === true ){
                            this.PassportService.userData = r.content;
                            this.PassportService.isLogin = true;
                            return true;
                        }
                        if ( r.success === false ){
                            this.router.navigateByUrl("/passport/login");
                        }
                    })
            }
        }
        if (next.data.auth === false) {
            return true;
        }
    }
}
 Why  return true;  in  subscribe  has no effect 
know that subscribe cannot return something, but how to solve this
