angular-guards Questions

5

Solved

From the Angular documentation on canActivate, it seems you can only use canActivate guards to allow proceeding to a route if the canActivate function ultimately returns true. Is there some way to...

1

Solved

I'm writing a guard that prevents a user to access a target url whenever he is not authenticated. I'm writing a functional guard to achieve this, however when I try to access the (target) url via t...
Oxime asked 15/2, 2023 at 15:25

9

Solved

In my Angular 4 application I have some components with a form, like this: export class MyComponent implements OnInit, FormComponent { form: FormGroup; ngOnInit() { this.form = new FormGroup(...
Delilahdelimit asked 26/9, 2017 at 18:13

0

I have nested components: AppComponent Contains just router-outlet PageWrapperComponent Contains just the main-menu and another router-outlet Requires the main-menu to get loaded from the API ...
Cryotherapy asked 3/11, 2021 at 14:59

2

I have a component to which navigate like this this.router.navigate(['results'], { state }); and once there i grab the data in the contructor constructor(private router: Router) { const { state ...
Selfhood asked 11/8, 2020 at 14:41

1

Solved

I've got this routes AppRouting { path: 'user', canLoad: [AuthGuard], loadChildren: () => import('./user/user.module').then((m) => m.PublicUserModule) } UserRouting { path: '', com...
Condyle asked 19/5, 2020 at 16:55

1

Solved

All, Before implementing the auth guard, I was able to hide my Navbar from login and registration screen. By reading the route events in component.ts and hiding the nav-bar by ngIf. After I implem...

1

Solved

I already have an AuthService to authenticate user on login and AuthGuard to prevent access if not logged in. Some pages I restrict access by UserProfile/Role but now I need to prevent actions on...
Sonometer asked 7/8, 2019 at 17:17

1

Solved

I'm having issues with the Angular router during the process of navigating to a provided state. I have tried using a custom guard with canLoad() and canActivate() functions returning booleans as t...
Ketchup asked 10/10, 2018 at 20:6

1

Solved

I have this AuthGuard: export class AuthGuard implements CanActivate { constructor (private router: Router) {} canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observabl...
Amnesty asked 16/11, 2017 at 13:50
1

© 2022 - 2024 — McMap. All rights reserved.