| Line 150: |
Line 150: |
| | .... | | .... |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | + | |
| | + | == Routing == |
| | + | |
| | + | === app-routing.module.ts === |
| | + | <syntaxhighlight lang="typescript"> |
| | + | import { RouterModule, Routes } from '@angular/router'; |
| | + | import {LoginComponent} from "./login/login.component"; |
| | + | import {ErrorComponent} from "./error/error.component"; |
| | + | |
| | + | const routes: Routes = [ |
| | + | { path: '', component: LoginComponent}, |
| | + | { path: 'login', component: LoginComponent}, |
| | + | { path: 'welcome', component: LoginComponent}, |
| | + | { path: '**', component: ErrorComponent} |
| | + | ]; |
| | + | |
| | + | @NgModule({ |
| | + | imports: [RouterModule.forRoot(routes)], |
| | + | exports: [RouterModule] |
| | + | }) |
| | + | export class AppRoutingModule { } |
| | + | |
| | + | </syntaxhighlight> |
| | + | |
| | + | == Error component == |
| | + | ng g c error |