UNPKG

cd-force

Version:

Form creation goodness.

21 lines (15 loc) 854 B
<div [formGroup]="form" class="form-group"> <label *ngIf="control.controlType != 'checkbox'" class="control-label" [attr.for]="control.key">{{control.label}}</label> <div [ngSwitch]="control.controlType"> <input class="form-control" *ngSwitchCase="'textbox'" [formControlName]="control.key" [id]="control.key" [type]="control.type"> <select class="form-control" [id]="control.key" *ngSwitchCase="'dropdown'" [formControlName]="control.key"> <option *ngFor="let opt of control.options" [value]="opt.key">{{opt.value}}</option> </select> <div *ngSwitchCase="'checkbox'"> <input type="checkbox" [id]="control.key" [formControlName]="control.key"> <label [for]="control.key">{{control.label}}</label> </div> </div> <div class="errorMessage" *ngIf="!isValid">{{control.label}} is required</div> </div> <br/>