From 0357a5a88a43a2a595fea36901573fb54e302e3f Mon Sep 17 00:00:00 2001 From: Art Date: Fri, 17 Sep 2021 17:09:41 +0300 Subject: [PATCH] 134.2. Configuring routes - config (#17) --- README.md | 2 +- .../src/app/app-routing.module.ts | 20 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c8aa776..8c6541d 100644 --- a/README.md +++ b/README.md @@ -9,4 +9,4 @@ - Generate AppRoutingModule - `ng generate module app-routing --flat --module=app` - +- Modify `app-routing.module.ts` diff --git a/support-portal-frontend/src/app/app-routing.module.ts b/support-portal-frontend/src/app/app-routing.module.ts index 0327f64..76cba5f 100644 --- a/support-portal-frontend/src/app/app-routing.module.ts +++ b/support-portal-frontend/src/app/app-routing.module.ts @@ -1,11 +1,19 @@ import {NgModule} from '@angular/core'; -import {CommonModule} from '@angular/common'; +import {RouterModule, Routes} from "@angular/router"; +import {LoginComponent} from "./component/login/login.component"; +import {RegisterComponent} from "./component/register/register.component"; +import {UserComponent} from "./component/user/user.component"; +const routes: Routes = [ + {path: 'login', component: LoginComponent}, + {path: 'register', component: RegisterComponent}, + {path: 'user/management', component: UserComponent}, + {path: '', redirectTo: '/login', pathMatch: 'full'} +]; @NgModule({ - declarations: [], - imports: [ - CommonModule - ] + imports: [RouterModule.forRoot(routes)], + exports: [RouterModule] }) -export class AppRoutingModule { } +export class AppRoutingModule { +}