Fixes bug on Composite Field when all child fields where deleted.

This commit is contained in:
Diamantis Tziotzios 2019-03-14 11:29:35 +02:00
parent 19416d29e7
commit 2843ac6660
1 changed files with 5 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormArray, FormControl, FormGroup } from '@angular/forms';
import { FieldEditorModel } from '../../../admin/field-editor-model';
import { FieldSetEditorModel } from '../../../admin/field-set-editor-model';
@Component({
selector: 'app-dataset-profile-editor-composite-field-component',
@ -35,6 +36,10 @@ export class DatasetProfileEditorCompositeFieldComponent implements OnInit {
}
(this.form.get('fields') as FormArray).controls.splice(1);
}
if ((<FormArray>this.form.get('fields')).length === 0) {
const field: FieldEditorModel = new FieldEditorModel();
(<FormArray>this.form.get('fields')).push(field.buildForm());
}
}
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {