Angular 6: Guard on all routes is not working
up vote
0
down vote
favorite
I'm trying to make the frontend secured by only letting certain Id's getting access. I want that If someone try to enter any route except for /login/:id, he'll get page-not-found if he didn't logged already, but it's not working. These are my routing table and guard: EDIT: I edited the routing table and added to 'login/:id' redirectTo, and now there aren't any errors, but the id is undefined so it's go to page-not-found component even though I entered login/1. when I tried to debug the code, I noticed that the route isn't of login/1 but '' even if I wrote in the url login/1. app-routing.module.ts
// Routing array - set routes to each html page
const appRoutes: Routes = [
{ path: 'login/:id', redirectTo:'/courses', canActi...