| 
									
										
										
										
											2019-09-12 15:20:54 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							| 
									
										
										
										
											2020-05-19 12:08:49 -07:00
										 |  |  |  * Copyright Google LLC All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2019-09-12 15:20:54 -07:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import {Component} from '@angular/core'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-02 13:54:18 -07:00
										 |  |  | export interface Address { | 
					
						
							|  |  |  |   streetName: string; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-28 16:12:09 -07:00
										 |  |  | /** The most heroic being. */ | 
					
						
							| 
									
										
										
										
											2019-09-19 17:04:02 -07:00
										 |  |  | export interface Hero { | 
					
						
							| 
									
										
										
										
											2019-09-12 15:20:54 -07:00
										 |  |  |   id: number; | 
					
						
							|  |  |  |   name: string; | 
					
						
							| 
									
										
										
										
											2020-10-02 13:54:18 -07:00
										 |  |  |   address?: Address; | 
					
						
							| 
									
										
										
										
											2019-09-12 15:20:54 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @Component({ | 
					
						
							|  |  |  |   selector: 'my-app', | 
					
						
							| 
									
										
										
										
											2020-06-05 22:42:35 -07:00
										 |  |  |   template: `
 | 
					
						
							|  |  |  |     <h1>{{title}}</h1> | 
					
						
							|  |  |  |     <h2>{{hero.name}} details!</h2> | 
					
						
							| 
									
										
										
										
											2019-09-12 15:20:54 -07:00
										 |  |  |   `
 | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | export class AppComponent { | 
					
						
							| 
									
										
										
										
											2020-09-28 16:12:09 -07:00
										 |  |  |   /** This is the title of the `AppComponent` Component. */ | 
					
						
							| 
									
										
										
										
											2019-09-12 15:20:54 -07:00
										 |  |  |   title = 'Tour of Heroes'; | 
					
						
							|  |  |  |   hero: Hero = {id: 1, name: 'Windstorm'}; | 
					
						
							| 
									
										
										
										
											2019-09-19 17:04:02 -07:00
										 |  |  |   private internal: string = 'internal'; | 
					
						
							| 
									
										
										
										
											2020-09-28 16:12:09 -07:00
										 |  |  |   heroP = Promise.resolve(this.hero); | 
					
						
							|  |  |  |   heroes: Hero[] = [this.hero]; | 
					
						
							|  |  |  |   heroesP = Promise.resolve(this.heroes); | 
					
						
							|  |  |  |   tupleArray: [string, Hero] = ['test', this.hero]; | 
					
						
							|  |  |  |   league: Hero[][] = [this.heroes]; | 
					
						
							|  |  |  |   heroesByName: {[name: string]: Hero} = {}; | 
					
						
							|  |  |  |   primitiveIndexType: {[name: string]: string} = {}; | 
					
						
							|  |  |  |   anyValue: any; | 
					
						
							|  |  |  |   optional?: string; | 
					
						
							|  |  |  |   // Use to test the `index` variable conflict between the `ngFor` and component context.
 | 
					
						
							|  |  |  |   index = null; | 
					
						
							|  |  |  |   myClick(event: any) {} | 
					
						
							|  |  |  |   birthday = new Date(); | 
					
						
							|  |  |  |   readonlyHeroes: ReadonlyArray<Readonly<Hero>> = this.heroes; | 
					
						
							|  |  |  |   constNames = [{name: 'name'}] as const; | 
					
						
							|  |  |  |   private myField = 'My Field'; | 
					
						
							|  |  |  |   strOrNumber: string|number = ''; | 
					
						
							| 
									
										
										
										
											2020-06-04 06:35:30 -07:00
										 |  |  |   setTitle(newTitle: string) { | 
					
						
							|  |  |  |     this.title = newTitle; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-09-12 15:20:54 -07:00
										 |  |  | } |