adding nested controls...
This commit is contained in:
parent
0850b6cde4
commit
e60020cc53
|
@ -33,13 +33,14 @@
|
||||||
|
|
||||||
<!-- OK SO FAR -->
|
<!-- OK SO FAR -->
|
||||||
<p>group {{ind}}</p>
|
<p>group {{ind}}</p>
|
||||||
<div formArrayName="facetProps" style="border: 1px solid rgb(84, 193, 255); padding: 10px; margin: 5px;">
|
<div formArrayName="facetGuis" style="border: 1px solid rgb(84, 193, 255); padding: 10px; margin: 5px;">
|
||||||
<div formGroupName="ind">
|
<div formGroupName="ind">
|
||||||
<div *ngFor="let facet of facetProps.controls; let i=index" >
|
<div *ngFor="let prop of typeSpec.facetSpecs[ind].guiProps; let i=index" >
|
||||||
<p> control {{i}} - <label>{{typeSpec.facetSpecs[ind].guiProps[i].label}}</label>
|
<p> control {{i}} - <label>{{prop.label}}</label>
|
||||||
<input formControlName="name" type="{{typeSpec.facetSpecs[ind].guiProps[i].type}}"/>
|
<input formControlName="i" type="{{prop.type}}"/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,10 @@ export class FacetComposerComponent implements OnInit {
|
||||||
typeSpec: ITypeSpecification;
|
typeSpec: ITypeSpecification;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
facetGuis: any;
|
||||||
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/member-ordering
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
||||||
constructor(private guiService: FacetComposerService, private fb: FormBuilder,
|
constructor(private guiService: FacetComposerService, private fb: FormBuilder,
|
||||||
private dialogRef:MatDialogRef<FacetComposerComponent>,
|
private dialogRef:MatDialogRef<FacetComposerComponent>,
|
||||||
|
@ -46,11 +50,10 @@ export class FacetComposerComponent implements OnInit {
|
||||||
|
|
||||||
this.myForm = this.fb.group({
|
this.myForm = this.fb.group({
|
||||||
facets: this.fb.array([]),
|
facets: this.fb.array([]),
|
||||||
|
facetGuis:this.fb.array([]),
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.guiService.getFormStructure(this.titlePath,this.titleType).subscribe(res => {
|
this.guiService.getFormStructure(this.titlePath,this.titleType).subscribe(res => {
|
||||||
this.typeSpec = res;
|
this.typeSpec = res;
|
||||||
|
@ -69,12 +72,13 @@ export class FacetComposerComponent implements OnInit {
|
||||||
ctrl = this.fb.control({
|
ctrl = this.fb.control({
|
||||||
name: ['',Validators.required]
|
name: ['',Validators.required]
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fGroup.addControl(''+String(j),ctrl);
|
//fGroup.addControl(''+String(j),ctrl);
|
||||||
|
fGroup.addControl('',ctrl); //AGGIUNGO FORMCONTROL AL FORMGROUP
|
||||||
}
|
}
|
||||||
this.myForm.addControl('facetGui'+String(ind),fGroup); //AGGIUNGO FORMGROUP PER LA FACET
|
//this.myForm.addControl('facetGui'+String(ind),fGroup); //AGGIUNGO FORMGROUP PER LA FACET
|
||||||
|
this.myForm.addControl('',fGroup); //AGGIUNGO FORMGROUP PER LA FACET
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue