| 
									
										
										
										
											2016-03-16 14:39:06 -04:00
										 |  |  | // #docplaster
 | 
					
						
							|  |  |  | // #docregion
 | 
					
						
							| 
									
										
										
										
											2016-03-25 16:03:53 -07:00
										 |  |  | import 'package:angular2/core.dart'; | 
					
						
							| 
									
										
										
										
											2016-08-17 13:31:40 -07:00
										 |  |  | // #docregion import-router
 | 
					
						
							| 
									
										
										
										
											2016-03-16 14:39:06 -04:00
										 |  |  | import 'package:angular2/router.dart'; | 
					
						
							| 
									
										
										
										
											2016-08-17 13:31:40 -07:00
										 |  |  | // #enddocregion import-router
 | 
					
						
							| 
									
										
										
										
											2016-03-16 14:39:06 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 13:31:40 -07:00
										 |  |  | import 'dashboard_component.dart'; | 
					
						
							|  |  |  | import 'hero_detail_component.dart'; | 
					
						
							|  |  |  | import 'hero_service.dart'; | 
					
						
							|  |  |  | import 'heroes_component.dart'; | 
					
						
							| 
									
										
										
										
											2016-03-16 14:39:06 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | @Component( | 
					
						
							|  |  |  |     selector: 'my-app', | 
					
						
							| 
									
										
										
										
											2016-08-17 13:31:40 -07:00
										 |  |  |     // #docregion template, template-v3
 | 
					
						
							| 
									
										
										
										
											2016-03-16 14:39:06 -04:00
										 |  |  |     template: '''
 | 
					
						
							|  |  |  |       <h1>{{title}}</h1> | 
					
						
							|  |  |  |       <nav> | 
					
						
							|  |  |  |         <a [routerLink]="['Dashboard']">Dashboard</a> | 
					
						
							|  |  |  |         <a [routerLink]="['Heroes']">Heroes</a> | 
					
						
							|  |  |  |       </nav> | 
					
						
							|  |  |  |       <router-outlet></router-outlet>''',
 | 
					
						
							| 
									
										
										
										
											2016-08-17 13:31:40 -07:00
										 |  |  |     // #enddocregion template, template-v3
 | 
					
						
							|  |  |  |     // #docregion styleUrls
 | 
					
						
							| 
									
										
										
										
											2016-03-16 14:39:06 -04:00
										 |  |  |     styleUrls: const ['app_component.css'], | 
					
						
							| 
									
										
										
										
											2016-08-17 13:31:40 -07:00
										 |  |  |     // #enddocregion styleUrls
 | 
					
						
							|  |  |  |     // #docregion directives-and-providers
 | 
					
						
							| 
									
										
										
										
											2016-03-16 14:39:06 -04:00
										 |  |  |     directives: const [ROUTER_DIRECTIVES], | 
					
						
							|  |  |  |     providers: const [HeroService, ROUTER_PROVIDERS]) | 
					
						
							| 
									
										
										
										
											2016-08-17 13:31:40 -07:00
										 |  |  | // #enddocregion directives-and-providers
 | 
					
						
							|  |  |  | // #docregion heroes
 | 
					
						
							| 
									
										
										
										
											2016-03-16 14:39:06 -04:00
										 |  |  | @RouteConfig(const [ | 
					
						
							| 
									
										
										
										
											2016-08-17 13:31:40 -07:00
										 |  |  |   // #enddocregion heroes
 | 
					
						
							|  |  |  |   // #docregion dashboard
 | 
					
						
							| 
									
										
										
										
											2016-03-16 14:39:06 -04:00
										 |  |  |   const Route( | 
					
						
							|  |  |  |       path: '/dashboard', | 
					
						
							|  |  |  |       name: 'Dashboard', | 
					
						
							|  |  |  |       component: DashboardComponent, | 
					
						
							|  |  |  |       useAsDefault: true), | 
					
						
							| 
									
										
										
										
											2016-08-17 13:31:40 -07:00
										 |  |  |   // #enddocregion dashboard
 | 
					
						
							|  |  |  |   // #docregion hero-detail
 | 
					
						
							| 
									
										
										
										
											2016-03-16 14:39:06 -04:00
										 |  |  |   const Route( | 
					
						
							|  |  |  |       path: '/detail/:id', name: 'HeroDetail', component: HeroDetailComponent), | 
					
						
							| 
									
										
										
										
											2016-08-17 13:31:40 -07:00
										 |  |  |   // #enddocregion hero-detail
 | 
					
						
							|  |  |  |   // #docregion heroes
 | 
					
						
							| 
									
										
										
										
											2016-03-16 14:39:06 -04:00
										 |  |  |   const Route(path: '/heroes', name: 'Heroes', component: HeroesComponent) | 
					
						
							|  |  |  | ]) | 
					
						
							| 
									
										
										
										
											2016-08-17 13:31:40 -07:00
										 |  |  | // #enddocregion heroes
 | 
					
						
							| 
									
										
										
										
											2016-03-16 14:39:06 -04:00
										 |  |  | class AppComponent { | 
					
						
							|  |  |  |   String title = 'Tour of Heroes'; | 
					
						
							|  |  |  | } |