I have a dynamic form that receives a array of jsons with the field to be displayed. My problem is in the ng-model and ng-required they are in the array,cant get the value to be in the ng-model name
This is my code:
the form containing the data
form_array : [
{label: "Responsable", name: "dynamic", required: true},
{label: "Username", name: "user1", required: true},
{label: "Number", name: "user2", required: false},
{label: "Age", name: "user3", required: false}
]
html to display the form fields
<form name="form" class="form-submit">
<div class="form-group">
<div ng-repeat="fa in form_array ">
<label>{{fa.label}} {{fa.name}} {{fa.required}}</label> <input class="form-control" type="text"
ng-model="requestForm.{{fa.name}}" ng-required={{fa.required}}></div>
</div>
<button id="resetbtn" class="btn btn-primary" type="reset" value="Reset">Limpar</button>
<button id="sendReport" class="btn btn-primary" ng-disabled="requestForm.$invalid"
ng-click="send(form)">