diff --git a/src/dynamic/dynamic.directive.spec.ts b/src/dynamic/dynamic.directive.spec.ts index 3447f07ff..6443fc0a0 100644 --- a/src/dynamic/dynamic.directive.spec.ts +++ b/src/dynamic/dynamic.directive.spec.ts @@ -138,6 +138,12 @@ describe('Directive: Dynamic', () => { fixture.componentInstance['inputs'] = null; expect(() => fixture.detectChanges()).not.toThrow(); }); + + it('should NOT throw exception when same inputs are reassigned with new object', () => { + fixture.detectChanges(); + fixture.componentInstance['inputs'] = { ...fixture.componentInstance['inputs'] }; + expect(() => fixture.detectChanges()).not.toThrow(); + }); }); describe('inputs with `NgComponentOutlet`', () => { diff --git a/src/dynamic/dynamic.directive.ts b/src/dynamic/dynamic.directive.ts index e70b6741b..ef0b963d8 100644 --- a/src/dynamic/dynamic.directive.ts +++ b/src/dynamic/dynamic.directive.ts @@ -89,8 +89,12 @@ export class DynamicDirective implements OnChanges, DoCheck, OnDestroy { this.bindOutputs(); } else { if (this._inputsChanged(changes)) { - this._updateInputChanges(this._getInputsChanges(this._inputs)); - this.updateInputs(!this._lastInputChanges); + const inputsChanges = this._getInputsChanges(this._inputs); + + if (inputsChanges) { + this._updateInputChanges(inputsChanges); + this.updateInputs(!this._lastInputChanges); + } } if (this._outputsChanged(changes)) {