angular-cn/public/docs/_examples/ngmodule/ts/app/hero/hero-routing.module.ts
Brandon ff118810ff docs(router): Updated routing examples to use routing modules (#2478)
Simplified routing in tutorial example

Updated ngmodule guide and ngmodule faq with routing module prose
2016-10-05 14:59:09 -07:00

24 lines
618 B
TypeScript

import { NgModule } from '@angular/core';
import { Routes,
RouterModule } from '@angular/router';
import { HeroComponent } from './hero.component';
import { HeroListComponent } from './hero-list.component';
import { HeroDetailComponent } from './hero-detail.component';
const routes: Routes = [
{ path: '',
component: HeroComponent,
children: [
{ path: '', component: HeroListComponent },
{ path: ':id', component: HeroDetailComponent }
]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class HeroRoutingModule {}