I\'m trying to return an observable when I get a certain value in a subscriber, but I fail miserably.
This is the code:
canActivate(route: Activated
We can convert the Observable object to promise using toPromise
method.
so the code can be implemented as followed:
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot):Promise {
// get route to be activated
this.routeToActivate = route.routeConfig.path;
// get user access levels
return this._firebase.isUserAdmin
.map(user => {
return (user.access_level === 'admin');
}).toPromise();
}