angular2-guards Questions
4
Solved
So, I'm trying to protect the access to several routes by using guards. I'm using the following routes to do so :
const adminRoutes : Routes = [
{
path: 'admin',
component: AdminComponent,
can...
Selfabnegation asked 6/3, 2017 at 17:41
3
Solved
Sorry for asking this type of question. But I'm not able to find any blog or youtube tutorials on writing the canActivate guard file testing. Nor in the official documentation there is anything men...
Faery asked 19/12, 2016 at 8:15
3
Solved
I have an AccessGuard class in my project which its work is to determine if user can access to the route or not. I used the router.url to get the current route but the url returns the route before ...
Beattie asked 28/9, 2016 at 12:15
3
This is the guard:
// my.guard.ts
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router';
Injectable()
export class...
Manse asked 28/7, 2016 at 19:34
2
Is there a way to set a "base" canActivate when configuring routes in Angular2? So that all routes are covered by the same base check, and then each route can have a more granular check.
I have an...
Bucaramanga asked 10/11, 2016 at 9:3
2
Solved
My application allows access to contents based on user roles. I wrote a Router Guard for each role. Some contents allow access for role1 or role2 or role3. How should I write that canActivate decla...
Pantoja asked 1/4, 2017 at 23:20
2
Solved
I have an route guard on one of my private routes and when guard returns false it is not called again anymore. The following example is simplified how to reproduce such situation.
When user naviga...
Catercorner asked 19/11, 2016 at 11:44
2
Solved
I've created a CanDeactivate guard which returns an observable and it's applied to a component which is loaded in a inner nested router-outlet. Should this guard be called whenever one tries to nav...
Aldus asked 14/12, 2016 at 16:52
2
I'm building an application where there's no access at all for unauthenticated users.
I wrote a LoggedInGuard, but now I have to add canActivate: [LoggedInGuard] to every route inside my router co...
Coston asked 19/12, 2016 at 9:29
1
Solved
I have a route guard like below
@Injectable()
export class AuthGuard implements CanActivate {
constructor(private router: Router, private authenticationSvc: AuthenticationService) { }
canActivat...
Wozniak asked 1/3, 2017 at 23:2
1
Solved
What I want to achieve: I want to share authentication state across my application using BehaviorSubject. I use the authentication state e.g. inside an auth-guard to prevent the user from visiting ...
Retroflex asked 21/2, 2017 at 11:40
1
How can I get the route which the user is trying to open within an canActivate guard in angular 2?
How can I make the guard watch for every route parameter change eg. a change of the id within the...
Beckner asked 11/2, 2017 at 1:55
1
Solved
I'm trying to implement an auth guard in my app. ie; Only authenticated users can access certain routes of my app. I'm following the tut given here.
Once the user is logged in I change a boolea...
Revocation asked 30/12, 2016 at 6:54
1
Solved
I have these lines in my router:
..
canActivate: [MyGuard],
path: "search",
component: SearchComponent,
data: {
accessRoles: [roleAdmin, roleUser]
}
..
I want to limit access to SearchCom...
Morisco asked 9/9, 2016 at 10:46
1
© 2022 - 2024 — McMap. All rights reserved.