Simplified routing in tutorial example Updated ngmodule guide and ngmodule faq with routing module prose
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| // #docplaster
 | |
| // #docregion
 | |
| import { NgModule }       from '@angular/core';
 | |
| import { BrowserModule }  from '@angular/platform-browser';
 | |
| import { FormsModule }    from '@angular/forms';
 | |
| import { RouterModule }   from '@angular/router';
 | |
| 
 | |
| import { AppComponent }        from './app.component';
 | |
| import { HeroDetailComponent } from './hero-detail.component';
 | |
| import { HeroesComponent }     from './heroes.component';
 | |
| import { HeroService }         from './hero.service';
 | |
| 
 | |
| @NgModule({
 | |
|   imports: [
 | |
|     BrowserModule,
 | |
|     FormsModule,
 | |
|     RouterModule.forRoot([
 | |
|       {
 | |
|         path: 'heroes',
 | |
|         component: HeroesComponent
 | |
|       }
 | |
|     ])
 | |
|   ],
 | |
|   declarations: [
 | |
|     AppComponent,
 | |
|     HeroDetailComponent,
 | |
|     HeroesComponent
 | |
|   ],
 | |
|   providers: [
 | |
|     HeroService
 | |
|   ],
 | |
|   bootstrap: [ AppComponent ]
 | |
| })
 | |
| export class AppModule {
 | |
| }
 | |
| // #enddocregion
 | |
| /*
 | |
| // #docregion heroes, routing
 | |
| import { RouterModule }   from '@angular/router';
 | |
| 
 | |
| RouterModule.forRoot([
 | |
|   {
 | |
|     path: 'heroes',
 | |
|     component: HeroesComponent
 | |
|   }
 | |
| ])
 | |
| // #enddocregion heroes, routing
 | |
| */
 |