Simplified routing in tutorial example Updated ngmodule guide and ngmodule faq with routing module prose
		
			
				
	
	
		
			38 lines
		
	
	
		
			999 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			999 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| // #docplaster
 | |
| // #docregion
 | |
| import { NgModule }      from '@angular/core';
 | |
| import { RouterModule }  from '@angular/router';
 | |
| 
 | |
| import { AdminComponent }           from './admin.component';
 | |
| import { AdminDashboardComponent }  from './admin-dashboard.component';
 | |
| import { ManageCrisesComponent }    from './manage-crises.component';
 | |
| import { ManageHeroesComponent }    from './manage-heroes.component';
 | |
| 
 | |
| // #docregion admin-routes
 | |
| @NgModule({
 | |
|   imports: [
 | |
|     RouterModule.forChild([
 | |
|       {
 | |
|         path: 'admin',
 | |
|         component: AdminComponent,
 | |
|         children: [
 | |
|           {
 | |
|             path: '',
 | |
|             children: [
 | |
|               { path: 'crises', component: ManageCrisesComponent },
 | |
|               { path: 'heroes', component: ManageHeroesComponent },
 | |
|               { path: '', component: AdminDashboardComponent }
 | |
|             ]
 | |
|           }
 | |
|         ]
 | |
|       }
 | |
|     ])
 | |
|   ],
 | |
|   exports: [
 | |
|     RouterModule
 | |
|   ]
 | |
| })
 | |
| export class AdminRoutingModule {}
 | |
| // #enddocregion admin-routes
 | |
| // #enddocregion
 |