bugs with radiobox&combobox

This commit is contained in:
annampak 2018-01-22 16:28:33 +02:00
parent 4f2fb712cf
commit 0d47fe0fd6
5 changed files with 14 additions and 12 deletions

View File

@ -13,7 +13,7 @@ export class ComboboxComponent implements OnInit{
options = [{id:"autocomplete", value: "autocomplete"}, {id:"wordlist", value: "wordlist"}];
ngOnInit(){
if (this.dataModel.data){
if (this.dataModel.data && this.form.get("data")){
this.type = this.form.get("data").get("type").value;
}

View File

@ -1,9 +1,10 @@
<div [formGroup]="form" class="form-row">
<div class="form-group col-md-12">
<label>Label</label>
<input type="string" class="form-control" formControlName="label">
</div>
<div formGroupName="data">
<div class="form-group col-md-12">
<label>Label</label>
<input type="string" class="form-control" formControlName="label">
</div>
<div formArrayName="options">
<div *ngFor="let option of form.get('data').get('options').controls index as i">
<div [formGroupName]="i">
@ -21,8 +22,8 @@
</div>
<div>
<a (click)="addNewRow(form)" style="cursor: pointer">
Add +
</a>
Add +
</a>
</div>
</div>

View File

@ -17,9 +17,10 @@ export class RadioBoxComponent implements OnInit{
private options = new Array<ListingItem>();
ngOnInit(){
if (this.form.get("data")) this.form.removeControl("data");
this.form.addControl("data", this.data.buildForm());
this.addNewRow();
//if (this.form.get("data")) this.form.removeControl("data");
if (!this.form.get("data"))
this.form.addControl("data", this.data.buildForm());
if(!this.dataModel.data) this.addNewRow();
}
addNewRow(){

View File

@ -9,7 +9,7 @@
<div formGroupName="viewStyle">
<div class="form-group">
<label>View style</label>
<select class="form-control" formControlName="renderStyle">
<select class="form-control" formControlName="renderStyle" (change)= "onchangeCombo($event)">
<option value="textarea">textarea</option>
<option value="booleanDecision">booleanDecision</option>
<option value='combobox'>combobox</option>

View File

@ -48,6 +48,6 @@ export class FieldFormComponent {
}
onchangeCombo() {
debugger;
if (this.form.get("data")) this.form.removeControl("data");
}
}