Skip to content

Commit

Permalink
fix(core): check expressions before emitting modelChange (#1977)
Browse files Browse the repository at this point in the history
  • Loading branch information
aitboudad committed Dec 13, 2019
1 parent f685d3b commit 510570e
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/core/src/lib/components/formly.form.ts
Expand Up @@ -52,15 +52,6 @@ export class FormlyForm implements DoCheck, OnChanges, OnDestroy {
private initialModel: any;
private modelChangeSubs: Subscription[] = [];

private enableCheckExprDebounce = false;
private checkExpressionChange$ = this.modelChange.pipe(
debounceTime(this.enableCheckExprDebounce ? 100 : 0),
).subscribe(() => {
this.enableCheckExprDebounce = true;
this.checkExpressionChange();
this.enableCheckExprDebounce = false;
});

constructor(
private formlyBuilder: FormlyFormBuilder,
private formlyConfig: FormlyConfig,
Expand Down Expand Up @@ -94,11 +85,11 @@ export class FormlyForm implements DoCheck, OnChanges, OnDestroy {

ngOnDestroy() {
this.clearModelSubscriptions();
this.checkExpressionChange$.unsubscribe();
}

changeModel(event: { key: string, value: any }) {
assignModelValue(this.model, event.key.split('.'), event.value);
this.checkExpressionChange();
this.modelChange.emit(clone(this.model));
}

Expand Down

0 comments on commit 510570e

Please sign in to comment.