diff --git a/README.md b/README.md index 72dbbc6..cf93840 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # AngularGuards +Demo - https://angular-guards-canload.vercel.app + This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.1.1. ## Development server diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 1e0d9ec..9850b10 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,11 +1,18 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { AuthGuard } from './auth/auth.guard'; import { HomeComponent } from './home/home.component'; import { NonAuthenticatedComponent } from './non-authenticated/non-authenticated.component'; const routes: Routes = [ { path: '', pathMatch: 'full', redirectTo: 'home' }, { path: 'home', component: HomeComponent }, + { + path: 'users', + canLoad: [AuthGuard], + loadChildren: () => + import('./users/users.module').then((m) => m.UsersModule), + }, { path: 'non-auth', component: NonAuthenticatedComponent }, ]; diff --git a/src/app/app.component.html b/src/app/app.component.html index bf4278e..74577e1 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -2,7 +2,7 @@ {{ title }} - +