import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.service'; import { CompositeField } from '../../models/CompositeField'; import { FormGroup, FormArray } from '@angular/forms'; import { Section } from '../../entities/model/section'; import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core'; import { Field } from '../../models/Field'; @Component({ selector: 'df-composite-field', templateUrl: './dynamic-form-composite-field.html', styleUrls: [ './dynamic-form-composite-field.css' ], encapsulation: ViewEncapsulation.None, }) export class DynamicFormCompositeFieldComponent implements OnInit { @Input() compositeField: CompositeField @Input() form: FormGroup; @Input() pathName: string; @Input() path: string; constructor(private visibilityRulesService: VisibilityRulesService) { } ngOnInit() { console.log(this.form); } addMultipleField(fieldIndex: number) { let field: Field = this.compositeField.fields[fieldIndex].cloneForMultiplicity(fieldIndex,""); this.compositeField.fields[fieldIndex].multiplicityItems.push(field); ((this.form.get("fields").get('' + fieldIndex).get('multiplicityItems'))).push(field.buildForm()); } }