Skip to content

Commit

Permalink
set subform value before attaching it
Browse files Browse the repository at this point in the history
  • Loading branch information
wouter-willems committed Aug 24, 2023
1 parent 1419be9 commit fcc0611
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion projects/klippa/ngx-enhancy-forms/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@klippa/ngx-enhancy-forms",
"version": "14.7.2",
"version": "14.7.3",
"publishConfig": {
"access": "public"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export class FormComponent implements OnInit, OnDestroy, OnChanges {
this.formGroup.disable();
}
const valueBeforeInject = injectInto.at(injectAt)?.value;
injectInto.setControl(injectAt, this.formGroup);
if (isValueSet(valueBeforeInject)) {
this.formGroup.patchValue(valueBeforeInject);
}
injectInto.setControl(injectAt, this.formGroup);
} else if (injectInto instanceof UntypedFormGroup) {
if (typeof injectAt !== 'string') {
throw new Error(`cannot index FormGroup with ${typeof injectAt}`);
Expand All @@ -60,10 +60,10 @@ export class FormComponent implements OnInit, OnDestroy, OnChanges {
this.formGroup.disable();
}
const valueBeforeInject = injectInto.get(injectAt)?.value;
injectInto.setControl(injectAt, this.formGroup);
if (isValueSet(valueBeforeInject)) {
this.formGroup.patchValue(valueBeforeInject);
}
injectInto.setControl(injectAt, this.formGroup);
}
}
if (isValueSet(this.patchValueInterceptor)) {
Expand Down

0 comments on commit fcc0611

Please sign in to comment.