I have a guard which needs to check the value in ngrx selector before activating a route. If no value in the state, then we need to navigate somewhere else. I have two problems here. First is that i kind of got solved, that when checking the value in ngrx selector with subscribe, the guard completes before we execute the code in the subscription the second problem is how can i get the guard to navigate, if no value now in the mergeMap i can check if value in the state, but if not, i cannot create url tree so i did it to return Observable of false so the code compiles. In that case, the guard does not activate the route, but i do not know how to navigate in this case * export const isLoggedGuard: CanActivateFn = ( route: ActivatedRouteSnapshot, state: RouterStateSnapshot ): | Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree => { return inject(Store) .select(userSelector) .pipe( mergeMap((user: UserInterface | null) => (user ? of(true) : of(false))), catchError(() => [inject(Router).createUrlTree(['/'])]) ); }; If I do: let isLogged = false; loggedSelector.subscribe((isLoggedSelectorValue: boolean ) => { islogged = isLoggedSelectorValue } the guard completes before we go into the subscribe Continue reading...