angular-router-guards Questions
5
I know angular route guards execute in the specified order when the canActivate function returns a simple boolean, however, what if the guards return type Observable<boolean> or Promise<bo...
Spates asked 19/6, 2017 at 22:48
1
Solved
I'm implementing a functional router guard in Angular 15.2.9 which checks if a user is logged in. When this is not the case, the guard should return either false or a UrlTree (i.e. redirect to logi...
Broome asked 13/9, 2023 at 13:49
6
How can I make use of the latest CanActivateFn in Angular 16 with DI?
The recent Angular 16 uses a function, not a class, for the canactivate functionality.
This is my code below. How can I add my ...
Sale asked 8/5, 2023 at 23:7
2
Solved
I need to make a simple confirm window and I saw a lot of examples of how to do it with extra actions (like waiting until file uploading of form is not field). But I need just make a default confir...
Economize asked 15/1, 2019 at 13:32
4
I'm new to both Cypress and Azure AD, but I've been following the steps described here to create Cypress tests on an existing Angular app that uses Azure AD. It mentions that they are using ADAL, b...
Toilet asked 26/9, 2020 at 7:3
6
In my current logout call, I have something like this:
getLogoutConfirmation(){
// get confirmation in modal and perform logout
// redirect to login page
}
Issue is, when logout is performed...
Selfhypnosis asked 10/1, 2018 at 11:48
1
Solved
import {Router, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree} from '@angular/router';
@Injectable({provideIn: 'root'})
export class FooGuard implements CanActivate {
constructor (private ...
Anderer asked 22/1, 2020 at 3:38
4
Solved
I have 2 guards, AuthGuard and AccessGuard in the application.
AuthGuard protects all the pages as the name suggests and stores the session object in the GlobalService and AccessGuard depends on th...
Anisometropia asked 10/5, 2017 at 13:2
4
I have a bit of a pickle.
I am using Route guard (implementing CanActivate interface) to check if user is granted access to particular route:
const routes: Routes = [
{
path: '',
component: Das...
Siphonostele asked 22/5, 2018 at 23:20
1
Solved
return this.auth.user.pipe(
switchMap((user: IUser) => {
return of(true);
})
);
My initial code was a bit more complex with some cases depending on the user data, but for testing purposes ...
Displease asked 13/9, 2019 at 14:57
2
I'm trying to use the canDeactivate router guard. The component I'm passing in (ClaimsViewComponent) is null the first time the code runs. But on subsequent runs, the code runs as expected.
We're t...
Punkah asked 20/7, 2018 at 21:1
1
Solved
I am trying to set up a simple canDeactivate guard in Angular 7, and I have tried code from a number of online tutorials, but they all yield the same error:
"Type 'CanDeactivate' is not generic....
Myra asked 17/2, 2019 at 7:12
3
Solved
Introduction
I'm trying to create a route guard in Angular2+ using Observable from the shared service which holds the string value of current user role.
The problem is obviously in shifting my min...
Scorcher asked 16/10, 2018 at 23:16
1
How do I redirect to a child route from a guard of the parent route while also protecting child routes from direct access*?
Problem with absolute navigation the guard on the parent component is ca...
Alric asked 25/9, 2018 at 23:11
2
Currently, in Angular, you can restrict access to all child routes by applying a router guard to one of the parents:
export const routes: Routes = [
{
path: 'my-account',
canActivate: [IsUserLo...
Levorotation asked 9/2, 2018 at 22:25
3
Solved
I'm trying to load some data before my application starts. The reason why I need to do it, is because some of the menu has restricted access based on some user condition, for example, based on the ...
Receptacle asked 9/8, 2017 at 0:7
1
Solved
I'm having an issue trying to navigate through different routes.
I have two different route modules.
app.routes.ts:
Containing only LoginPage:
export const routes: Routes = [
{
path: 'login',...
Lycaon asked 13/9, 2017 at 10:3
3
Solved
I have this interface that i'm using to prevent the user to leave page
export interface ComponentCanDeactivate {
canDeactivate: () => boolean;
}
@Injectable()
export class PendingChangesGuard...
Tachymetry asked 4/12, 2017 at 19:43
1
Solved
As far as I know the call signature of canActivate looks like this:
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
}
I have a service that expects the name of a compon...
Childs asked 6/12, 2017 at 17:4
1
Solved
I'm making an online store, and there's an administration part from where you can track orders and modify them.
It is protected by authentication, which is done on a node server, passwords ...
Henslowe asked 30/11, 2017 at 15:23
1
Solved
If my Angular app, if I navigate (via explicitly typing in the URL or clicking a page link to it) to http://localhost:4200/#/sign-in the page loads fine and shows my sign in form. If I then click R...
Unquestionable asked 16/11, 2017 at 21:38
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
2
Solved
I'm using a Guard on an Angular application to resolve initial critical data. On the version 4 of Angular I was duing it like this:
// app.routing.ts
routing = [{
path: '', component: AppComponen...
Interpretation asked 9/11, 2017 at 20:25
1
Solved
I currently have a home page that routes to all the different workflows my company runs. We have about 15 different workflows and each workflow is guarded by a user role. If you don't have the corr...
Nitro asked 6/11, 2017 at 18:52
2
I am confronted with the following issue: the personal section which is protected via an AuthGuard Service is loaded twice when I navigate to it or by browser refresh. Second time it strips away th...
Mcnew asked 28/8, 2017 at 7:35
1 Next >
© 2022 - 2024 — McMap. All rights reserved.