| 
									
										
										
										
											2016-04-07 21:11:13 -07:00
										 |  |  | // #docregion pt1
 | 
					
						
							|  |  |  | import 'package:angular2/core.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // #docregion hero-class-1
 | 
					
						
							|  |  |  | class Hero { | 
					
						
							|  |  |  |   final int id; | 
					
						
							|  |  |  |   String name; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Hero(this.id, this.name); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | // #enddocregion hero-class-1
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @Component( | 
					
						
							|  |  |  |     selector: 'my-app', | 
					
						
							|  |  |  |     template: '''
 | 
					
						
							|  |  |  |       <h1>{{title}}</h1> | 
					
						
							|  |  |  |       <h2>{{hero.name}} details!</h2> | 
					
						
							|  |  |  |       <div><label>id: </label>{{hero.id}}</div> | 
					
						
							|  |  |  |       <div> | 
					
						
							|  |  |  |         <label>name: </label> | 
					
						
							| 
									
										
										
										
											2016-06-07 14:59:41 -07:00
										 |  |  |         <input [(ngModel)]="hero.name" placeholder="name"> | 
					
						
							| 
									
										
										
										
											2016-04-07 21:11:13 -07:00
										 |  |  |       </div>'''
 | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | class AppComponent { | 
					
						
							|  |  |  |   String title = 'Tour of Heroes'; | 
					
						
							| 
									
										
										
										
											2016-06-07 14:59:41 -07:00
										 |  |  |   // #docregion hero-property-1
 | 
					
						
							| 
									
										
										
										
											2016-04-07 21:11:13 -07:00
										 |  |  |   Hero hero = new Hero(1, 'Windstorm'); | 
					
						
							| 
									
										
										
										
											2016-06-07 14:59:41 -07:00
										 |  |  |   // #enddocregion hero-property-1
 | 
					
						
							| 
									
										
										
										
											2016-04-07 21:11:13 -07:00
										 |  |  | } | 
					
						
							|  |  |  | // #enddocregion pt1
 |