project setup
This commit is contained in:
46
src/app/pages/veriable-form/veriable-form.component.html
Normal file
46
src/app/pages/veriable-form/veriable-form.component.html
Normal file
@@ -0,0 +1,46 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="variableCal">
|
||||
<form [formGroup]="formGroup">
|
||||
|
||||
<div class="form-group" formArrayName="items" *ngFor="let item of items.controls; let i = index">
|
||||
<div class="row" [formGroupName]="i">
|
||||
<div class="col-md-3">
|
||||
<select formControlName="type" (change)="onTypeChange(i)" class="form-control">
|
||||
<option value="" selected disabled > Select </option>
|
||||
<option value="variable">Variable</option>
|
||||
<option value="text">Text</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3" *ngIf="item.get('type')?.value === 'variable'">
|
||||
<select formControlName="variable" class="form-control">
|
||||
<option value="" selected disabled > Select </option>
|
||||
<option *ngFor="let v of variableList" [value]="v">{{ v }}</option>
|
||||
</select>
|
||||
<div>
|
||||
<p>Variable Calculation: {{ calculateVariable(i) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="item.get('type')?.value === 'text'" class="col-md-3">
|
||||
<input formControlName="text" placeholder="Enter text here" class="form-control" />
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button class="btn btn-danger" (click)="removeRow(i)" *ngIf="items.length > 1">Remove Row</button>
|
||||
<button class="btn btn-primary ml-2" (click)="addRow()" *ngIf="i === items.length - 1">Add Row</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<button type="submit" class="btn btn-primary" (click)="onSubmit()" >Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user