1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { HomeComponent } from './home/home.component'; import { AboutComponent } from './about/about.component'; import { HelpComponent } from './help/help.component'; import { AbcComponent } from './home/abc/abc.component'; import { DefComponent } from './home/def/def.component';
const routes: Routes = [ { path: 'home', component: HomeComponent, }, { path: 'about', component: AboutComponent, }, { path: 'product', component: HelpComponent, children: [ { path: 'product-list', component: AbcComponent, }, { path: 'product-detail', component: DefComponent, }, ], }, ];
@NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] }) export class AppRoutingModule { }
|