Fixed issue with dynamic group component

This commit is contained in:
Giuseppe Digilio
2018-12-10 16:07:26 +01:00
parent 97973f32c8
commit 251d93c4b3
2 changed files with 6 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ import { AbstractControl, FormGroup } from '@angular/forms';
import {
DYNAMIC_FORM_CONTROL_TYPE_ARRAY,
DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX_GROUP,
DYNAMIC_FORM_CONTROL_TYPE_GROUP,
DYNAMIC_FORM_CONTROL_TYPE_GROUP, DYNAMIC_FORM_CONTROL_TYPE_INPUT,
DYNAMIC_FORM_CONTROL_TYPE_RADIO_GROUP,
DynamicFormArrayModel,
DynamicFormControlModel,
@@ -271,6 +271,10 @@ export class FormBuilderService extends DynamicFormService {
return model.type === DYNAMIC_FORM_CONTROL_TYPE_ARRAY;
}
isInputModel(model: DynamicFormControlModel): boolean {
return model.type === DYNAMIC_FORM_CONTROL_TYPE_INPUT;
}
getFormControlById(id: string, formGroup: FormGroup, groupModel: DynamicFormControlModel[], index = 0): AbstractControl {
const fieldModel = this.findById(id, groupModel, index);
return isNotEmpty(fieldModel) ? formGroup.get(this.getPath(fieldModel)) : null;