commit test / field html

This commit is contained in:
annampak 2017-09-18 12:38:06 +03:00
parent 1e07f983e0
commit 5ef6708efb
1 changed files with 20 additions and 4 deletions

View File

@ -26,10 +26,26 @@
</div> --> </div> -->
<div [formGroup]="form" class="form-group" [ngSwitch]="field.controlType"> <div [formGroup]="form" class="form-group" [ngSwitch]="field.controlType">
<div [ngClass]="{true:'show', false:'hide'}[field.visible]">
<label [attr.for]="field.key">{{field.label}}</label>
<input *ngSwitchCase="'textbox'" class="form-control" [formControlName]="field.key" [id]="field.key" [type]="field.type"
required="field.required" [(ngModel)]="field.value">
<select [id]="field.key" *ngSwitchCase="'dropdown'" class="form-control" [formControlName]="field.key" [(ngModel)]="field.value">
<option *ngFor="let opt of field.options" [value]="opt.key">{{opt.value}}</option>
</select>
<input *ngSwitchCase="'checkbox'" [formControlName]="field.key" [(ngModel)]="field.value" [id]="field.key" [type]="field.type"
(change)="toggleVisibility($event, field)" #ckb> <!--(change)="field.value = ckb.checked"-->
</div>
</div>
<!-- <div [formGroup]="form" class="form-group" [ngSwitch]="field.controlType">
<div *ngIf= "field.rules; else elseBlock "> <div *ngIf= "field.rules; else elseBlock ">
<div *ngIf="field.rules.length > 0; else elseBlock"> <div *ngIf="field.rules.length > 0; else elseBlock">
<div *ngFor="let rule of field.rules"> <div *ngFor="let rule of field.rules">
@ -70,4 +86,4 @@
</ng-template> </ng-template>
</div> </div> -->