When I add canActivate that returns either an Observable or Promise (in this case a promise) the routing works correctly but it seems to block things like (click) events, pipes don't work correctly, etc... These functions all work as soon as I make canActivate just return true. Any suggestions?
canActivate
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean | Promise<boolean> {
return Stamplay.User.currentUser()
.then((res) => {
if (res.user) {
return true;
} else {
this.router.navigate(['/login']);
return false;
}
}).catch(() => {
this.router.navigate(['/login']);
return false;
});
For example, the material search doesn't work with canActivate, but works perfectly when I just return true or take canActivate out.