When deleting the first fieldset all the values from the second fieldset will be moved to the first fieldset instead of just the first value (ref #156)
This commit is contained in:
parent
69fde5f353
commit
894b358f9a
|
@ -61,8 +61,11 @@ export class FormSectionComponent implements OnInit, OnChanges {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteCompositeFieldFormGroup(compositeFildIndex: number) {
|
deleteCompositeFieldFormGroup(compositeFildIndex: number) {
|
||||||
const firstMultiplicityItem = this.form.get('compositeFields').get('' + compositeFildIndex).get('multiplicityItems').get('' + 0).get('fields').get('' + 0).value;
|
const numberOfItems = this.form.get('compositeFields').get('' + compositeFildIndex).get('multiplicityItems').get('' + 0).get('fields').value.length;
|
||||||
this.form.get('compositeFields').get('' + compositeFildIndex).get('fields').get('' + 0).patchValue(firstMultiplicityItem);
|
for (let i = 0; i < numberOfItems; i++) {
|
||||||
|
const multiplicityItem = this.form.get('compositeFields').get('' + compositeFildIndex).get('multiplicityItems').get('' + 0).get('fields').get('' + i).value;
|
||||||
|
this.form.get('compositeFields').get('' + compositeFildIndex).get('fields').get('' + i).patchValue(multiplicityItem);
|
||||||
|
}
|
||||||
(<FormArray>(this.form.get('compositeFields').get('' + compositeFildIndex).get('multiplicityItems'))).removeAt(0);
|
(<FormArray>(this.form.get('compositeFields').get('' + compositeFildIndex).get('multiplicityItems'))).removeAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue