| 
									
										
										
										
											2016-02-02 14:39:34 +01:00
										 |  |  | // #docregion
 | 
					
						
							| 
									
										
										
										
											2016-05-03 14:06:32 +02:00
										 |  |  | import { Component } from '@angular/core'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import { VersionChildComponent } from './version-child.component'; | 
					
						
							| 
									
										
										
										
											2016-02-02 14:39:34 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | @Component({ | 
					
						
							|  |  |  |   selector: 'version-parent', | 
					
						
							|  |  |  |   template: `
 | 
					
						
							|  |  |  |     <h2>Source code version</h2> | 
					
						
							|  |  |  |     <button (click)="newMinor()">New minor version</button> | 
					
						
							|  |  |  |     <button (click)="newMajor()">New major version</button> | 
					
						
							|  |  |  |     <version-child [major]="major" [minor]="minor"></version-child> | 
					
						
							|  |  |  |   `,
 | 
					
						
							|  |  |  |   directives: [VersionChildComponent] | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | export class VersionParentComponent { | 
					
						
							|  |  |  |   major: number = 1; | 
					
						
							|  |  |  |   minor: number = 23; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   newMinor() { | 
					
						
							|  |  |  |     this.minor++; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   newMajor() { | 
					
						
							|  |  |  |     this.major++; | 
					
						
							|  |  |  |     this.minor = 0; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | // #enddocregion
 |