1. 程式人生 > >Angular4 step by step.3

Angular4 step by step.3

pen 分享 -1 edi sco lar ide mod code

1.Routes 路由模塊

技術分享
 1 import { NgModule }             from [email protected]/core‘;
 2 import { RouterModule, Routes } from [email protected]/router‘;
 3 
 4 import { DashboardComponent }   from ‘./dashboard.component‘;
 5 import { HeroesComponent }      from ‘./heroes.component‘;
 6 import { HeroDetailComponent }  from ‘./hero-detail.component‘;
7 8 const routes: Routes = [ 9 { path: ‘‘, redirectTo: ‘/dashboard‘, pathMatch: ‘full‘ }, 10 { path: ‘dashboard‘, component: DashboardComponent }, 11 { path: ‘detail/:id‘, component: HeroDetailComponent }, 12 { path: ‘heroes‘, component: HeroesComponent } 13 ]; 14 15 @NgModule({ 16 imports: [ RouterModule.forRoot(routes) ],
17 exports: [ RouterModule ] 18 }) 19 export class AppRoutingModule {}
View Code

2.路由模塊還是蠻繞的,看了2天

3.技術分享

4.哇哈哈截圖留念

技術分享

Angular4 step by step.3