diff --git a/public/docs/_examples/cb-component-communication/e2e-spec.ts b/public/docs/_examples/cb-component-communication/e2e-spec.ts index b83589cc32..d78e0784d9 100644 --- a/public/docs/_examples/cb-component-communication/e2e-spec.ts +++ b/public/docs/_examples/cb-component-communication/e2e-spec.ts @@ -1,4 +1,4 @@ -'use strict'; // necessary for es6 output in node +'use strict'; // necessary for es6 output in node import { browser, element, by } from 'protractor'; @@ -65,7 +65,7 @@ describe('Component Communication Cookbook Tests', function () { let actual = getActual(); let initialLabel = 'Version 1.23'; - let initialLog = 'major changed from {} to 1, minor changed from {} to 23'; + let initialLog = 'Initial value of major set to 1, Initial value of minor set to 23'; expect(actual.label).toBe(initialLabel); expect(actual.count).toBe(1); diff --git a/public/docs/_examples/cb-component-communication/ts/app/version-child.component.ts b/public/docs/_examples/cb-component-communication/ts/app/version-child.component.ts index 72bc07ddb3..89d365cf9f 100644 --- a/public/docs/_examples/cb-component-communication/ts/app/version-child.component.ts +++ b/public/docs/_examples/cb-component-communication/ts/app/version-child.component.ts @@ -21,9 +21,13 @@ export class VersionChildComponent implements OnChanges { 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}`); + let to = JSON.stringify(changedProp.currentValue); + if (changedProp.isFirstChange()) { + log.push(`Initial value of ${propName} set to ${to}`); + } else { + let from = JSON.stringify(changedProp.previousValue); + log.push(`${propName} changed from ${from} to ${to}`); + } } this.changeLog.push(log.join(', ')); } diff --git a/public/resources/images/cookbooks/component-communication/parent-to-child-on-changes.gif b/public/resources/images/cookbooks/component-communication/parent-to-child-on-changes.gif index 4ff7657f5b..debccd9448 100644 Binary files a/public/resources/images/cookbooks/component-communication/parent-to-child-on-changes.gif and b/public/resources/images/cookbooks/component-communication/parent-to-child-on-changes.gif differ