2016-04-28 20:36:35 -04:00
|
|
|
/* tslint:disable:forin */
|
2016-02-02 08:39:34 -05:00
|
|
|
// #docregion
|
2016-05-03 08:06:32 -04:00
|
|
|
import { Component, Input, OnChanges, SimpleChange } from '@angular/core';
|
2016-02-02 08:39:34 -05:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'version-child',
|
|
|
|
template: `
|
|
|
|
<h3>Version {{major}}.{{minor}}</h3>
|
|
|
|
<h4>Change log:</h4>
|
|
|
|
<ul>
|
2016-04-28 20:36:35 -04:00
|
|
|
<li *ngFor="let change of changeLog">{{change}}</li>
|
2016-02-02 08:39:34 -05:00
|
|
|
</ul>
|
|
|
|
`
|
|
|
|
})
|
|
|
|
export class VersionChildComponent implements OnChanges {
|
|
|
|
@Input() major: number;
|
|
|
|
@Input() minor: number;
|
|
|
|
changeLog: string[] = [];
|
|
|
|
|
|
|
|
ngOnChanges(changes: {[propKey:string]: SimpleChange}){
|
|
|
|
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-28 20:36:35 -04:00
|
|
|
// #enddocregion
|