change name toFormGroupAlt
This commit is contained in:
parent
77b44527b5
commit
5c5bf3bfd0
|
@ -54,6 +54,10 @@ export class DataModel {
|
|||
return this.fIndex.get(key);
|
||||
}
|
||||
|
||||
public getFieldSourceByKey(key){
|
||||
return this.fIndSources.get(key);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ export class DynamicFormComponent implements OnInit {
|
|||
|
||||
|
||||
constructor(private qcs: FieldControlService, private serverService: ServerService, private fieldVisibility: FieldVisibility, private dataModelService: dataModelBuilder) {
|
||||
this.form = this.qcs.toFormGroup(new Array());
|
||||
this.form = this.qcs.toFormGroup(new Array(), new Array());
|
||||
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ export class DynamicFormComponent implements OnInit {
|
|||
this.dataModel = new DataModel();
|
||||
this.dataModel = this.dataModelService.getDataModel(data);
|
||||
|
||||
this.form = this.qcs.toFormGroupAlt(this.dataModel.fields, this.dataModel.groups);
|
||||
this.form = this.qcs.toFormGroup(this.dataModel.fields, this.dataModel.groups);
|
||||
//this.form = this.qcs.toFormGroup(this.fields);
|
||||
|
||||
console.log("SUMMARY: ======>");
|
||||
|
|
|
@ -7,19 +7,9 @@ import { GroupBase } from '../form/dynamic-form-group/group-base';
|
|||
@Injectable()
|
||||
export class FieldControlService {
|
||||
constructor(){ }
|
||||
|
||||
toFormGroup(fields: FieldBase<any>[]){
|
||||
let group: any ={};
|
||||
fields.forEach(field => {
|
||||
group[field.key] = field.required ? new FormControl(field.value || '', Validators.required)
|
||||
: new FormControl(field.value || '')
|
||||
});
|
||||
|
||||
return new FormGroup(group);
|
||||
}
|
||||
|
||||
|
||||
toFormGroupAlt(fields: FieldBase<any>[], groups: GroupBase<any>[]){
|
||||
toFormGroup(fields: FieldBase<any>[], groups: GroupBase<any>[]){
|
||||
|
||||
let form: any = {};
|
||||
|
||||
|
|
Loading…
Reference in New Issue