Skip to content

Commit

Permalink
fix(directive): Fix breaking changes in Dynamic directive
Browse files Browse the repository at this point in the history
  • Loading branch information
gund committed Feb 16, 2017
1 parent 3880fa5 commit 0eca84a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/dynamic/dynamic.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
} from '@angular/core';
import { Subject } from 'rxjs/Subject';

export type KeyValueChangeRecordAny = KeyValueChangeRecord<any, any>;

@Directive({
selector: '[ndcDynamic], ndc-dynamic'
})
Expand Down Expand Up @@ -108,18 +110,18 @@ export class DynamicDirective implements OnChanges, DoCheck, OnDestroy {
const changes = {} as SimpleChanges;

Object.keys(this.ndcDynamicInputs).forEach(prop =>
changes[prop] = new CustomSimpleChange(UNINITIALIZED, this.ndcDynamicInputs[prop]));
changes[prop] = new CustomSimpleChange(UNINITIALIZED, this.ndcDynamicInputs[prop], true));

return changes;
}

private _collectChangesFromDiffer(differ: any): SimpleChanges {
const changes = {} as SimpleChanges;

differ.forEachItem((record: KeyValueChangeRecord) =>
changes[record.key] = new CustomSimpleChange(record.previousValue, record.currentValue));
differ.forEachItem((record: KeyValueChangeRecordAny) =>
changes[record.key] = new CustomSimpleChange(record.previousValue, record.currentValue, false));

differ.forEachAddedItem((record: KeyValueChangeRecord) =>
differ.forEachAddedItem((record: KeyValueChangeRecordAny) =>
changes[record.key].previousValue = UNINITIALIZED);

return changes;
Expand Down

0 comments on commit 0eca84a

Please sign in to comment.