Skip to content

Commit

Permalink
fix(core): sync fieldGroup length on FieldArrayType remove
Browse files Browse the repository at this point in the history
fix #3353
  • Loading branch information
aitboudad committed Jul 11, 2022
1 parent e1b9141 commit 8da376c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/src/lib/templates/field-array.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ export abstract class FieldArrayType<F extends FormlyFieldConfig = FieldArrayTyp

remove(i: number, { markAsDirty } = { markAsDirty: true }) {
this.model.splice(i, 1);
unregisterControl(this.field.fieldGroup[i], true);

const field = this.field.fieldGroup[i];
this.field.fieldGroup.splice(i, 1);
this.field.fieldGroup.forEach((f, key) => (f.key = `${key}`));
unregisterControl(field, true);
this._build();
markAsDirty && this.formControl.markAsDirty();
}
Expand Down

0 comments on commit 8da376c

Please sign in to comment.