Fixes bug on Composite Field when all child fields where deleted.
This commit is contained in:
parent
19416d29e7
commit
2843ac6660
|
@ -1,6 +1,7 @@
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { FormArray, FormControl, FormGroup } from '@angular/forms';
|
import { FormArray, FormControl, FormGroup } from '@angular/forms';
|
||||||
import { FieldEditorModel } from '../../../admin/field-editor-model';
|
import { FieldEditorModel } from '../../../admin/field-editor-model';
|
||||||
|
import { FieldSetEditorModel } from '../../../admin/field-set-editor-model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dataset-profile-editor-composite-field-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);
|
(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) {
|
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {
|
||||||
|
|
Loading…
Reference in New Issue