I am making application with angular dynamic form, where i have given a checkbox to display along with two input boxes.
<ng-container *ngSwitchCase="'checkbox'">
<input [formControlName]="question.key" type="checkbox"
[id]="index?question.key+index:question.key" >
<label [attr.for]="index?question.key+index:question.key"></label>
</ng-container>
You could able to see working stackblitz on https://stackblitz.com/edit/angular-x4a5b6-t1ctnf
Where i have given the form value to display using
<pre>
</pre>
At initial stage every inputs value will be a empty and on filling up the value will be displayed..
Likewise i would like to set a value for checkbox at initial stage to either boolean
false (as it is not checked at starting) or else to string
false..
You could able to see in stackblitz if we uncheck the checked it will display the boolean value as false
and true
if we check.. But i need to display either boolean nor string at initial stage (now it looks like "property_required": ""
) and the same data type should be the value if we check
or uncheck
the checkbox..
Aucun commentaire:
Enregistrer un commentaire