การใช้งาน routing module
ที่ไฟล์ app.module.ts ทำการเพิ่ม import
import { RouterModule, Routes } from '@angular/router';
ทำการเพิ่ม config ว่าจะมี path อะไรบ้าง
const appRoutes: Routes = [
{ path: '', component: FriendListComponent },
{ path: 'friend-list', component: FriendListComponent },
{ path: 'friend-table', component: FriendTableComponent }
]
ทำการเพิ่มเข้าไปในส่วนที่ Config module
imports: [
BrowserModule,
RouterModule.forRoot(appRoutes)
],
จากนั้น ที่ไฟล์ app.component.html แก้ไขเป็น ``` html
ลองใช้ Browser เปิดดูว่าสามารถใช้งานได้หรือไม่