5: Add In-app Navigation
[examples/angular-tour-of-heroes] / src / app / app-routing.module.ts
1 import { NgModule } from '@angular/core';
2 import { RouterModule, Routes } from '@angular/router';
3 import { HeroesComponent } from './heroes/heroes.component';
4 import { DashboardComponent } from './dashboard/dashboard.component';
5 import { HeroDetailComponent} from './hero-detail/hero-detail.component';
6
7
8 const routes : Routes = [
9   { path: '', redirectTo: 'dashboard', pathMatch: 'full'},
10   { path: 'heroes', component: HeroesComponent },
11   { path: 'detail/:id', component: HeroDetailComponent },
12   { path: 'dashboard', component: DashboardComponent }
13 ];
14
15
16 @NgModule({
17   imports: [ RouterModule.forRoot(routes) ],
18   exports: [ RouterModule ]
19 })
20 export class AppRoutingModule { }