我有一个实现CanActivate的AuthGuard(用于路由).
canActivate() {
return this.loginService.isLoggedIn();
}
我的问题是,CanActivate结果取决于http get结果——LoginService返回Observable.
isLoggedIn():Observable<boolean> {
return this.http.get(ApiResources.LOGON).map(response => response.ok);
}
我如何将这些结合在一起-使CanActivate依赖于后端状态?
# # # # # #
EDIT: Please note, that this question is from 2016 - a very early stage of angular/router has been used.