change name toFormGroupAlt
This commit is contained in:
parent
77b44527b5
commit
5c5bf3bfd0
|
@ -54,6 +54,10 @@ export class DataModel {
|
||||||
return this.fIndex.get(key);
|
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) {
|
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 = new DataModel();
|
||||||
this.dataModel = this.dataModelService.getDataModel(data);
|
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);
|
//this.form = this.qcs.toFormGroup(this.fields);
|
||||||
|
|
||||||
console.log("SUMMARY: ======>");
|
console.log("SUMMARY: ======>");
|
||||||
|
|
|
@ -8,18 +8,8 @@ import { GroupBase } from '../form/dynamic-form-group/group-base';
|
||||||
export class FieldControlService {
|
export class FieldControlService {
|
||||||
constructor(){ }
|
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);
|
toFormGroup(fields: FieldBase<any>[], groups: GroupBase<any>[]){
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
toFormGroupAlt(fields: FieldBase<any>[], groups: GroupBase<any>[]){
|
|
||||||
|
|
||||||
let form: any = {};
|
let form: any = {};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue