From 91cff2af2dcff79a9dd1f5835bec14eb6c2561d2 Mon Sep 17 00:00:00 2001 From: IlianSchokkaert Date: Sat, 7 Oct 2017 10:18:29 +0200 Subject: [PATCH] fix(datalayer): smarter ngOnChanges Fixes #1099 --- packages/core/directives/data-layer.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/directives/data-layer.ts b/packages/core/directives/data-layer.ts index ecef2a71b..d66704f36 100644 --- a/packages/core/directives/data-layer.ts +++ b/packages/core/directives/data-layer.ts @@ -267,9 +267,9 @@ export class AgmDataLayer implements OnInit, OnDestroy, OnChanges { } let dataOptions: DataOptions = {}; - const optionKeys = Object.keys(changes).filter( - k => AgmDataLayer._dataOptionsAttributes.indexOf(k) !== -1); - optionKeys.forEach(k => (dataOptions)[k] = changes[k].currentValue); + + AgmDataLayer._dataOptionsAttributes.forEach(k => (dataOptions)[k] = changes.hasOwnProperty(k) ? changes[k].currentValue : (this)[k]); + this._manager.setDataOptions(this, dataOptions); } }