| 
									
										
										
										
											2016-04-29 01:36:35 +01:00
										 |  |  | /* tslint:disable:forin */ | 
					
						
							| 
									
										
										
										
											2016-02-02 14:39:34 +01:00
										 |  |  | // #docregion
 | 
					
						
							| 
									
										
										
										
											2016-05-03 14:06:32 +02:00
										 |  |  | import { Component, Input, OnChanges, SimpleChange } from '@angular/core'; | 
					
						
							| 
									
										
										
										
											2016-02-02 14:39:34 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | @Component({ | 
					
						
							|  |  |  |   selector: 'version-child', | 
					
						
							|  |  |  |   template: `
 | 
					
						
							|  |  |  |     <h3>Version {{major}}.{{minor}}</h3> | 
					
						
							|  |  |  |     <h4>Change log:</h4> | 
					
						
							|  |  |  |     <ul> | 
					
						
							| 
									
										
										
										
											2016-04-29 01:36:35 +01:00
										 |  |  |       <li *ngFor="let change of changeLog">{{change}}</li> | 
					
						
							| 
									
										
										
										
											2016-02-02 14:39:34 +01:00
										 |  |  |     </ul> | 
					
						
							|  |  |  |   `
 | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | export class VersionChildComponent implements OnChanges { | 
					
						
							|  |  |  |   @Input() major: number; | 
					
						
							|  |  |  |   @Input() minor: number; | 
					
						
							|  |  |  |   changeLog: string[] = []; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-08 01:06:25 +02:00
										 |  |  |   ngOnChanges(changes: {[propKey: string]: SimpleChange}) { | 
					
						
							| 
									
										
										
										
											2016-02-02 14:39:34 +01:00
										 |  |  |     let log: string[] = []; | 
					
						
							|  |  |  |     for (let propName in changes) { | 
					
						
							|  |  |  |       let changedProp = changes[propName]; | 
					
						
							|  |  |  |       let from = JSON.stringify(changedProp.previousValue); | 
					
						
							|  |  |  |       let to =   JSON.stringify(changedProp.currentValue); | 
					
						
							|  |  |  |       log.push( `${propName} changed from ${from} to ${to}`); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     this.changeLog.push(log.join(', ')); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-04-29 01:36:35 +01:00
										 |  |  | // #enddocregion
 |