I have an AuthGuard (used for routing) that implements CanActivate.
canActivate() {
return this.loginService.isLoggedIn();
}
My problem is, that the CanActivate-result depends on a http-get-result - the LoginService returns an Observable.
isLoggedIn():Observable<boolean> {
return this.http.get(ApiResources.LOGON).map(response => response.ok);
}
How can i bring those together - make CanActivate depend on a backend state?
# # # # # #
EDIT: Please note, that this question is from 2016 - a very early stage of angular/router has been used.
# # # # # #
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…