* added example of feature module pre-loading * added transition aliases for route animations
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| // #docplaster
 | |
| // #docregion, preload-v1
 | |
| import { NgModule }     from '@angular/core';
 | |
| import { RouterModule } from '@angular/router';
 | |
| 
 | |
| import { CanDeactivateGuard } from './can-deactivate-guard.service';
 | |
| import { AuthGuard }          from './auth-guard.service';
 | |
| import { PreloadSelectedModules } from './selective-preload-strategy';
 | |
| 
 | |
| @NgModule({
 | |
|   imports: [
 | |
|     RouterModule.forRoot([
 | |
|       {
 | |
|         path: 'admin',
 | |
|         loadChildren: 'app/admin/admin.module#AdminModule',
 | |
|         canLoad: [AuthGuard]
 | |
|       },
 | |
|       {
 | |
|         path: '',
 | |
|         redirectTo: '/heroes',
 | |
|         pathMatch: 'full'
 | |
|       },
 | |
|       // #docregion preload-v2
 | |
|       {
 | |
|         path: 'crisis-center',
 | |
|         loadChildren: 'app/crisis-center/crisis-center.module#CrisisCenterModule',
 | |
|         data: {
 | |
|           preload: true
 | |
|         }
 | |
|       }
 | |
|       // #enddocregion preload-v2
 | |
|     ],
 | |
|     { preloadingStrategy: PreloadSelectedModules })
 | |
|   ],
 | |
|   exports: [
 | |
|     RouterModule
 | |
|   ],
 | |
|   providers: [
 | |
|     CanDeactivateGuard,
 | |
|     PreloadSelectedModules
 | |
|   ]
 | |
| })
 | |
| export class AppRoutingModule {}
 |