To find more information :
Questions tagged [angular-router-guards]
289 questions
1
vote
1 answer
angular - guards does not wait for parent resolvers to complete
My router is like this
const routes: Routes = [{
path: '',
canActivate: [AuthGuard],
resolve: {
user: UserResolver,
},
children: [{
path: 'home',
canActivate: [HomeGuard],
component: HomeComponent,
}, {
…

Yoann Picquenot
- 640
- 10
- 26
1
vote
2 answers
how to show just the components of the current user by role in angular
Hello every one i have a dashboard that has a menu of all the components :
i want when i m logged in with the role admin i want to display all the components
and if i m logged with the responsable role i want to show just the commandes component
i…

II-ZIAD- II
- 15
- 8
1
vote
1 answer
Angular CanDeactivate Guard is triggering recursively and failing to navigate to the component
Requirement: Showing a confirmation modal to the user when navigating to different component(UsersComponent) from the current component(ProductsComponent).If user prefers to leave, I have to navigate to some other component(SalesComponent) rather…

Uzma
- 11
- 4
1
vote
0 answers
Angular 10 - canActivate Guard Prevents Navigation to Correct URL When Entered Manually
In my Angular 10 application, I have a route with several child routes, that has a canActivate guard on it.
{
path: 'settings', component: SettingsComponent,
children: [
{ path: '', redirectTo: 'index-types', pathMatch: 'full' },
…

tired_but_inspired
- 21
- 5
1
vote
1 answer
Angular guard not redirecting to specific page due to exception
So I'm trying to implement a basic guard:
canActivate(route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable {
return this.userService.isBoardMember().pipe(
map(data => {
if (data === false) {
…

developer1
- 527
- 4
- 27
1
vote
1 answer
Observable is not working properly
I'm trying to implement a guard using userService to get the needed info. Currently the UserService looks like this:
getUserDetails(): Observable {
this.requestUrl = `${configs.bgwssApi}v1/user/details`;
return…

developer1
- 527
- 4
- 27
1
vote
1 answer
Implement Angular guard on password reset route
I'm having an issue trying to figure out how to validate the password-reset route when the user tries to enter manually in the URL.
The correct functionality is that the users will go the forgot-password route and from there, an email will be sent…

juan
- 25
- 3
1
vote
1 answer
Angular ngrx guard selected is undefined even if data has been loaded
I've got this reducer
on(CmsActions.loadCmsTopNewsSelected, (state, { slug }) => {
let selected;
if (state.data) {
selected = state.data.items.find(item => item.data.slug.iv === slug);
}
return {
...state,
selected
…

Whisher
- 31,320
- 32
- 120
- 201
1
vote
1 answer
How do I make a canActivate guard that depends on 2 http calls finishing?
I have 2 http calls, where the second depends on the first. How do I approach making a canActivate guard that waits for the two http calls to finish before returning true, and if it takes "too long", say 5 seconds, it returns false. In searching…

eflat
- 919
- 3
- 13
- 34
1
vote
2 answers
Link a guard (canDeactivate) and a component without use RouterModule
I call a component on a HTML page like this:
What I want it's link a guard canDeactivate with the component my-component. This component is never called by a route, so I don't add a path in RouterModule. I use…

Jordan PANTIN
- 11
- 3
1
vote
3 answers
How to apply canActivate guard for all routes(master route and all sub routes) in Angular
I use Angular Guard to protect my routes, i add canActivate attr in master route and it works fine, while for sub single routes(ReportsRouteModule/RequestsRouteModule...), if i want to enable guard, i alse need to set canActivate in each routes, i…

Rollsbean
- 715
- 2
- 11
- 31
1
vote
0 answers
Best approach to integrate native app like back button behavior in Angular Apps
When using native mobile apps, we can observe a common behavior that, when within the app if we open a dialog, open a menu, open select list; then pressing back button on mobile it closes the dialog, opened menu or opened select list.
I am trying to…

Naveed Ahmed
- 10,048
- 12
- 46
- 85
1
vote
4 answers
How to disable canActivate guard
After hours of searchig of where is CanActivate interface is implemented in the web app didn't find nothing. So I want to ask you is there a way to generally disable it? Cant access my url and didn't find any other redirect. It sends me to the login…

Toma Tomov
- 1,476
- 19
- 55
1
vote
0 answers
Guard doesn't work for selecting new image
I try to make a guard when data and image is not been saved. so when you leave the component and didn't triggered the save button. The user will have to get a warning
Googled followed tutorials
So the Guard works for data fields. But if I change the…

mightycode Newton
- 3,229
- 3
- 28
- 54
1
vote
2 answers
Angular 8 & Firebase AuthGuard still redirecting to login after user logged in
I'm having a trouble on the after logged-in, the links are not working or I cannot access the routes / links and still redirecting me back to the login page. What the correct output should be is I can access all the links / routes after logged-in.…
user11907948