Questions tagged [angular-router-guards]

To find more information :

289 questions
0
votes
0 answers

Router parseUrl() vs navigate() in Angular16

I am in Authenticate with authGuard. I would like to know the difference between these two // Redirect to the login page return router.navigate(['/login']); return router.parseUrl('/login'); In Angular official documentation it is showing…
0
votes
1 answer

Do not load a micro frontend if the user has not authenticated - single spa

Good morning community I am new to micro frontend, currently I am building an application where all the microfrontends are made in angular and i am using the single-spa plugin to display them. What I want is that if the user is authenticated, load…
0
votes
0 answers

Prevent leaving app with canDeactivate and intermediate page

To my angular app I added Redirect page which is opening first by routing. This page have only one purpose - redirect to home page (this.router.navigate(['home']);). To home page I added guard canDeactivate which is checking if nextRoute is redirect…
0
votes
0 answers

How to Access to path directly without passing by Root path in angular?

I have a confirmation path from backend http://localhost:4200/newsletter/test@gmail.com/confirm?confirmationId=9c7f8645-9cb9-495f-a0df-f6a843944372 I need to access in this path from paste it in browser to confirm email Link work if passing by home…
0
votes
1 answer

Angular routing (AuthGuard) inside a Docker Container

I have just deployed my Angular project inside a Docker Container. Path for me to access to the site is: localhost:4200, because on my machine is listening on 4200, but inside the container is listening at port 80. I'm using Angular routing, here's…
0
votes
0 answers

Route-guard no longer prevents navigation

I have built an angular website with a bootstrap navbar, where I use the [routerLinkActive] in order to highlight the links which indicate where the user is right now. The navlinks which don't route to a page, but just simply contain another…
Pieterjan
  • 2,738
  • 4
  • 28
  • 55
0
votes
1 answer

CanDeactivateFn in Ionic Angular

I would like to implement a CanDeactivate Guard in my Ionic Angular application. I've found out, that I should use the new "CanDeactivateFn" Guard, but I can't found any information or an example how to do it. Can somebody give me an example? That…
KTSB
  • 79
  • 4
0
votes
1 answer

Angular CanActivate Guard

I am developing a small project using Angular, Nodejs, Express, MySQL. In the project there is 2 type of user, customer user and contractor user. I am having difficulty in using CanActivate to guard the route for the 'Contractor Profile Page' and…
0
votes
0 answers

How to make custom Guard that redirects to Landing Page or Dashboard with Auth0-Angular?

Im trying to make a custom Guard for my landing page on Angular with Auth0, the logic is this: User types http://localhost:4200 If user is logged in then should redirecto to htttp://localhost:4200/dashboard If user is not logeed in then should let…
0
votes
0 answers

show the Microsoft Login page instantly when using msal for angular

MSAL library is used with Angular 15, every controller is protected with the MsalGuard in the app-routing file as follows: const routes: Routes = [ { path: 'protected-component', component: SomeProtectedComponent, canActivate: [ …
0
votes
1 answer

Why does Angular route resolver only listen to the first value of my observable?

I am working with Angular 15 and I am trying to use the routing resolver handler to prefetch products before loading a product-list component. This product-list component simply displays the products. I am very new to stackoverflow so I'll try my…
0
votes
1 answer

Return boolean observable on angular guard

I would like to block URL access from unauthorized users. I'm currently using canActivate with route Guard from angular to block users to access /my/specific_url_route. Indeed, I want to block some users (not listed in a list on my database) from…
0
votes
1 answer

Lock/deny url from users (angular guard)

I would like to block url access from unauthorized users. I'm currently using canActivate with route Guard from angular for blocking no Admin user to access /admin route (that's works OK). But now, I have an other use case that is a bit complex: I…
0
votes
0 answers

Generic types mismatch when dependencies passed as params within Angular functional guard

I am in the process of converting class-based guards to functional ones. I use some of the guards to fetch data from api in case data is not in store or is stale, so I have Store and Actions dependency involved. Below is the new guard…
user776686
  • 7,933
  • 14
  • 71
  • 124
0
votes
0 answers

Angular - Re-Trigger router guard

I have an angular app. There I have a route ('home') protected by a routeGuard. I locally save the username and hash(password) if the user has signed in once and on app load I fetch them and initiate the signin process, which is a server call and…