To find more information :
Questions tagged [angular-router-guards]
289 questions
0
votes
2 answers
Angular router activates wrong route guard
I'm having issues with Angular routing that don't seem to make much sense. With the following set-up, this outcome occurs...
App loads at path /
Auth guard runs
Auth guard returns false as there is not yet a JWT in storage
Redirection to /login…

Ben Brookes
- 419
- 4
- 15
0
votes
1 answer
CanDeactivate guards does not runs as expected, after pressing browser back button
I have implemented canDeactive guard, once browser button is clicked it popups a Model and ask Yes/No.
After clicking on No it stays on the same page and Again if i press the back button the popup appears and after clicking No/Yes button it…

Rohit Vaidya
- 3
- 4
0
votes
0 answers
Angular guard not working in children path
I am setting a guard in creditscore childpages but it seems that it is not working. I am trying to redirect back to /creditscore page if user is not authenticated, But when i access /crediscore/verification page it is not redirecting back to…

raf
- 165
- 1
- 14
0
votes
2 answers
Angular 8 auth guard - determine if user came from outside or from inside the app
Seems like a dumb question, but for some reason I can't figure out the answer.
I have an auth guard, which checks the expiration of the JWT token stored in local storage and throws "Your session has expired" dialog which redirects the user to login…

grreeenn
- 2,287
- 1
- 20
- 27
0
votes
0 answers
Protecting routes with paid subscriptions
I'm trying to protect routes with two subscriptions: Gold and Platinum. At the moment, I've created a new canActivate guard for each subscription:
{
path: 'messages',
component: MessagesComponent,
canActivate: [AuthGuard,…

mtchdev
- 66
- 11
0
votes
1 answer
Angular8 AngularFireAuth: authState.map for Guard canActivate() error: Property 'map' does not exist on type 'Observable'
I have an error with Angular8 AngularFireAuth when trying to define canActive() on a guard
I get an error:
Property 'map' does not exist on type 'Observable'.ts(2339)
import { Injectable } from "@angular/core";
import { CanActivate, Router } from…

Shahar Meshulam
- 148
- 1
- 6
0
votes
1 answer
Angular route guard not calling return
I have an auth class set up like this:
export class AuthService {
user = new Subject();
login(name: string) {
this.user.next(name);
}
}
I have an auth guard set up to check to see if my user subject has a value like this:
export…

Martheli
- 931
- 1
- 16
- 35
0
votes
1 answer
Router Guards in Angular 8
I created an application where the user inputs data. On that application, I want to implement router guards to deny the user to go back on-page so that they don't lose their data. If the user clicks on the back button on the browser, it reloads page…

Shank
- 413
- 4
- 15
0
votes
1 answer
Router Guard Issue?
I am facing a situation. I have a CanActivate router guard. Usage of the guards causes an unwanted reload of the whole page.
I implemented two versions of the guard and figured out something I do not understand. Can anybody explain the behavior and…

el peregrino
- 741
- 5
- 9
0
votes
1 answer
Implement Router Guard Based on NGRX Store
I want to implement a router guard based on the value in the store.if the user login to the application I want to get that user's role and activate the certain routes my submodule route.
I will post my current implementation but that didn't work at…

NicoleZ
- 1,485
- 3
- 22
- 43
0
votes
1 answer
Angular 4 initial page load candeactivate route guard not working
Using canDeactivate guard I am trying to prevent the browser back action.So, now loading the site url on my browser new tab successfully lands me on the initial page. Now without any user interaction on the page pressing the browser back button…

Geo j
- 181
- 3
- 16
0
votes
1 answer
Auth Guard not working correctly even when Logged in, redirecting always to login page
When I try to access url or redirect the page when NOT logged in, it worked fine, then when I LOGGED IN I can't still access that page, and redirecting me to the login page. Advice please thank you!
Auth.service.ts
//Import complete...
...
...…
user11907948
0
votes
1 answer
Navigation based on logged user type - Angular
I'm creating application with separate dashboards for different client types (businessClient, individualClient). Client type comes with session context, so it is known before navigation to dashboard starts. I would like to load proper dashboard…

Salarenko
- 105
- 5
0
votes
1 answer
What's the difference between Observable and UrlTree?
I'm implementing a canActivate guard for one of my app components.
Based on the documentation, both UrlTree and Observable are valid return types.
I understand that by wrapping 'a thing' into an observable would make the thing…

Zzz
- 1,703
- 1
- 14
- 21
0
votes
2 answers
How to make all non-child routes guarded?
I have created a routing module in my angular 6 application (app.routing.ts). I have added multiple routes to my application, but haven't used the child directive anywhere for my routes (bad practice yes, but now I have added dynamic routes as well…

Muhammad Hamza
- 823
- 1
- 17
- 42