get data from json

This commit is contained in:
annampak 2017-11-27 18:42:26 +02:00
parent 722cd8b482
commit d5d3f5ef37
6 changed files with 21 additions and 11 deletions

View File

@ -17,7 +17,7 @@ export class CompositeFieldFormComponent {
constructon(){}
ngOnInit(){
this.addNewField();
// this.addNewField();
}
addNewField(){

View File

@ -17,7 +17,7 @@ export class FieldFormComponent {
constructon(){}
ngOnInit(){
this.addNewRule();
//this.addNewRule();
}
addNewRule(){

View File

@ -17,7 +17,7 @@ export class GroupFieldFormComponent {
constructor(){}
ngOnInit(){
this.addNewField();
// this.addNewField();
}
addNewField(){

View File

@ -1,4 +1,4 @@
<div>
<div><!--style="border-style: solid;"-->
<h4 style="text-decoration: underline;">Section</h4>
<div [formGroup]="form">
<div class="form-row">
@ -8,17 +8,25 @@
</div>
<div class="form-group col-md-4">
<label>Id</label>
<input type="text" class="form-control" formControlName="id">
<input type="text" class="form-control" formControlName="id">
</div>
<div class="form-group col-md-4">
<label>defaultVisibility</label>
<input type="text" class="form-control" formControlName="defaultVisibility">
<input type="text" class="form-control" formControlName="defaultVisibility">
</div>
</div>
</div>
<div *ngFor="let fieldGroup of dataModel.fieldGroups let i=index;">
<groupfield-form [form]="form.get('fieldGroups').get(''+i)" [dataModel]="fieldGroup" ></groupfield-form>
<div *ngIf="dataModel.sections">
<div *ngFor="let section of dataModel.sections let i=index;">
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section"></section-form>
</div>
</div>
<div *ngIf="dataModel.fieldGroups">
<div *ngFor="let fieldGroup of dataModel.fieldGroups let i=index;">
<groupfield-form [form]="form.get('fieldGroups').get(''+i)" [dataModel]="fieldGroup"></groupfield-form>
</div>
</div>
<div>
<a (click)="addGroupField()" style="cursor: pointer">
Add another group +

View File

@ -18,12 +18,13 @@ export class SectionFormComponent {
constructor(){ }
ngOnInit(){
this.addGroupField();
//this.addGroupField(); //for new DatasetProfile
}
addGroupField(){
let fieldGroup:FieldGroup = new FieldGroup();
this.dataModel.fieldGroups.push(fieldGroup);
if(this.dataModel.fieldGroups)
this.dataModel.fieldGroups.push(fieldGroup);
(<FormArray>this.form.get("fieldGroups")).push(fieldGroup.buildForm());
}

View File

@ -26,7 +26,8 @@ export const TestModel = {
"title": "",
"description": "",
"extendedDescription": "",
"viewStyle": "checkBox"
"viewStyle": "checkBox",
"rule":[]
}
]
}